[英]The following packages don't support null safety
如何使用以下包以空安全運行
代碼:
void database() async {
// ignore: unused_local_variable
var database = await openDatabase('alimaher.db', version: 1,
onCreate: (database, vervion) {
// ignore: avoid_print
print('database created');
database
.execute(
'CREATE TABLE tasks (id INTEGER PRIMARY KEY,title TEXT, date TEXT,time TEXT,status TEXT ) ')
.then((value) {
// ignore: avoid_print
print('table created');
}).catchError((error) {
// ignore: avoid_print
print('error when creating table ${error.toString()}');
});
}, onOpen: (database) {
// ignore: avoid_print
print('database opened');
});
}
錯誤信息:
錯誤:無法以健全的空安全運行,因為以下依賴項不支持空安全:
- 包:sqflite
- 包:sqflite_common
- 包:同步
所有三個包在其最新版本中都支持聲音空安全。
您沒有顯示 pubspec.yaml,但我想您需要將這些軟件包更新到最新版本。
將軟件包更新到最新版本或使用--no-sound-null-safety
參數構建
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.