Closed Galzysoft closed 2 years ago
add this in pubspec.yaml sqlite3_flutter_libs:
databaseHelper.dart ==> use
_initDatabase() async {
DatabaseFactory _databaseFactory;
String path = '';
if (!kIsWeb && Platform.isWindows) {
sqfliteFfiInit();
_databaseFactory = databaseFactoryFfi;
final Directory _directory = await getApplicationSupportDirectory();
await _databaseFactory.setDatabasesPath(_directory.path);
path = join(await _databaseFactory.getDatabasesPath(), "name.db");
} else {
_databaseFactory = databaseFactory;
path = join(await _databaseFactory.getDatabasesPath(), "name.db");
}
_database = await _databaseFactory.openDatabase(path,
options: OpenDatabaseOptions(
onCreate: (Database db, int _) => _createDb(db), version: 1));
return _database;
}
Thanks this solve my problem thanks
add this in pubspec.yaml sqlite3_flutter_libs:
databaseHelper.dart ==> use
_initDatabase() async { DatabaseFactory _databaseFactory; String path = ''; if (!kIsWeb && Platform.isWindows) { sqfliteFfiInit(); _databaseFactory = databaseFactoryFfi; final Directory _directory = await getApplicationSupportDirectory(); await _databaseFactory.setDatabasesPath(_directory.path); path = join(await _databaseFactory.getDatabasesPath(), "name.db"); } else { _databaseFactory = databaseFactory; path = join(await _databaseFactory.getDatabasesPath(), "name.db"); } _database = await _databaseFactory.openDatabase(path, options: OpenDatabaseOptions( onCreate: (Database db, int _) => _createDb(db), version: 1)); return _database; }
can you provide your full code
the windows software I build with it is working very well on flutter debug mode or on released mode using the distribution folder method but I currently noticed that when I packaged the app with an installer (inno setup.exe and msix package ) I noticed that the database cant connect i also downloaded the sqlite3.dll file as you suggested in the documentation