How do i insert a var into sql statement on flutter sqflite? $Constants.dbColName doesnt work
Future<int> save(Item item) async {
final db = await database;
return db.delete(
Constants.dbTableName,
where: '$Constants.dbColName = ?',
whereArgs: [item.name],
);
}
posting @pskink s comment as an answer for future reference.
Use parenthesis to wrap the variable.
${Constants.dbColName}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.