Reputation: 5319
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],
);
}
Upvotes: 0
Views: 402
Reputation: 11491
posting @pskink s comment as an answer for future reference.
Use parenthesis to wrap the variable.
${Constants.dbColName}
Upvotes: 2