我在桌面窗口上为我的数据库使用sqflite ffi 。我设置了示例中的所有内容。该应用程序正在调试构建,但如果我在发布模式下运行该应用程序,我会在sqfliteFfiInit()
. 我该如何解决?
Invalid argument(s): Failed to load dynamic library (126)
Future<void> init() async {
try {
sqfliteFfiInit();
} catch (e) {
print(e.toString());
}
_databaseFactory = databaseFactoryFfi;
String path = '${await _databaseFactory.getDatabasesPath()}\\myDB.db';
_db = await _databaseFactory.openDatabase(path);
final List<Map<String, dynamic>> result = await _db.query(
'sqlite_master',
where: 'name = ?',
whereArgs: <String>['MyDB'],
);
if(result.isEmpty){
await _db.execute('''
CREATE TABLE MyDB (
id INTEGER PRIMARY KEY,
name TEXT
)
''');
}
}