我正在构建一个包含sqflite
个数据库的应用程序,运行应用程序时出现以下错误:
Flutter (9532):eeeeeeeee绑定尚未初始化.
这是我的main()
void main() async {
WidgetsFlutterBinding.ensureInitialized;
await DBHelper().initDb();
runApp(const MyApp());
}
这是initDB()
initDb() async {
try {
String databasePath = await getDatabasesPath(); //The break point stops here and show me the error above.
String path = join(databasePath, 'task.db');
Database ourdb = await openDatabase(path,
onCreate: _onCreate, version: _version, onUpgrade: _onUpgrade);
return ourdb;
} catch (e) {
print('eeeeeeeee $e nnnnnnnnnnnn');
}
}
那么,出了什么问题?