File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ library flutter_data;
33// import external packages
44import 'dart:async' ;
55import 'dart:convert' ;
6+ import 'dart:ffi' ;
67import 'dart:io' ;
78import 'dart:isolate' ;
89import 'dart:math' show Random;
@@ -15,6 +16,7 @@ import 'package:inflection3/inflection3.dart' as inflection;
1516import 'package:meta/meta.dart' ;
1617import 'package:path/path.dart' as path_helper;
1718import 'package:riverpod/riverpod.dart' ;
19+ import 'package:sqlite3/open.dart' ;
1820import 'package:sqlite3/sqlite3.dart' ;
1921import 'package:state_notifier/state_notifier.dart' ;
2022
Original file line number Diff line number Diff line change @@ -29,6 +29,10 @@ class LocalStorage {
2929 await destroy ();
3030 }
3131
32+ if (Platform .isWindows) {
33+ open.overrideFor (OperatingSystem .windows, _openOnWindows);
34+ }
35+
3236 db = sqlite3.open (path, mutex: false );
3337
3438 if (inIsolate) {
@@ -109,3 +113,12 @@ enum LocalStorageClearStrategy {
109113final localStorageProvider = Provider <LocalStorage >(
110114 (ref) => LocalStorage (baseDirFn: () => '' ),
111115);
116+
117+ // platforms
118+
119+ DynamicLibrary _openOnWindows () {
120+ final scriptDir = File (Platform .script.toFilePath ()).parent;
121+ final libraryNextToScript =
122+ File (path_helper.join (scriptDir.path, 'sqlite3.dll' ));
123+ return DynamicLibrary .open (libraryNextToScript.path);
124+ }
You can’t perform that action at this time.
0 commit comments