toListWhereColumnHasValue method
Future<List<ISQLiteItem> >
toListWhereColumnHasValue(
- ISQLiteItem item,
- String columnName,
- dynamic columnValueOf, {
- int? limit,
Implementation
Future<List<ISQLiteItem>> toListWhereColumnHasValue(
ISQLiteItem item, String columnName, dynamic columnValueOf,
{int? limit}) async {
String tableName = item.getTableName();
List<ISQLiteItem> results = [];
var db = await getOpenDatabase();
String condition = '$columnName = ?';
var maps = await db.query(
tableName,
where: condition,
whereArgs: [columnValueOf], // Pass the value as an array
limit: limit,
);
// Map the results to items
results = maps.map((map) => item.fromMap(map)).toList();
return results;
}