I am building my app using sqflite, but I cannot resolve an following error:
Unhandled Exception: DatabaseException(Error Domain=SqfliteDarwinDatabase Code=1 "no such table:plus"
My relating code is:
void initState() {
super.initState();
Future(() async {
db = await openDatabase(
join(await getDatabasesPath(), 'data.db'),
onCreate: (db, version) async{
await db.execute("CREATE TABLE IF NOT EXISTS plus(point INTEGER, goal TEXT);");
await db.execute("CREATE TABLE IF NOT EXISTS minus(point INTEGER, goal TEXT);");
},
// Set the version. This executes the onCreate function and provides a
// path to perform database upgrades and downgrades.
version: 1,
);
print("done");
}
);
}
...
await db.insert('plus', {
"point": Provider.of<ProvDatas>(context, listen: false).point_plus,
"goal": Provider.of<ProvDatas>(context, listen: false).text_plus});
If more detail code is needed, please let me know.
As a result, this problem was solved by uninstalling app and installing app again..!