未定义的名称 'ConflictAlgorithm'
Undefined name 'ConflictAlgorithm'
我在执行插入查询时遇到错误
final dbPath = await sql.getDatabasesPath();
final db = await sql.openDatabase(path.join(dbPath, 'history.db'),
onCreate: (db, version) {
return db.execute(
'CREATE TABLE history(id TEXT PRIMARY KEY, senderEmail TEXT, receiverEmail TEXT, amount REAL)');
}, version: 1);
await db.insert(table, data, conflictAlgorithm: ConflictAlgorithm.replace);
我通过ConflictAlgorithm.replace时出现错误,说
Undefined name 'ConflictAlgorithm'. Try correcting the name to one that is defined, or defining the name
此外,我正在关注:
您似乎正在导入带有前缀 (sql
) 的 sqflite
,而不是
ConflictAlgorithm.replace
你应该使用:
sql.ConflictAlgorithm.replace
我在执行插入查询时遇到错误
final dbPath = await sql.getDatabasesPath();
final db = await sql.openDatabase(path.join(dbPath, 'history.db'),
onCreate: (db, version) {
return db.execute(
'CREATE TABLE history(id TEXT PRIMARY KEY, senderEmail TEXT, receiverEmail TEXT, amount REAL)');
}, version: 1);
await db.insert(table, data, conflictAlgorithm: ConflictAlgorithm.replace);
我通过ConflictAlgorithm.replace时出现错误,说
Undefined name 'ConflictAlgorithm'. Try correcting the name to one that is defined, or defining the name
此外,我正在关注:
您似乎正在导入带有前缀 (sql
) 的 sqflite
,而不是
ConflictAlgorithm.replace
你应该使用:
sql.ConflictAlgorithm.replace