在将版本传递给 on create 方法和我想从数据库中获取的 id 的 integer(int) 时,我收到一条错误消息,指出“int 不是类型”错误图像
class NewsDbProvider {
Database db;
int() async {
Directory documentsDirectory =await getApplicationDocumentsDirectory();
final path = join(documentsDirectory.path, "items.db");
db = await openDatabase(
path,
version: 1,
onCreate: (Database newDb,int version){
newDb.execute("""
CREATE TABLE Items
(
)
""");
}
);
}
fetchItem(int id) async{
db.query(
"Items",
columns: null,
where: 'id = ?',
whereArgs: {id},
);
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
824 次 |
| 最近记录: |