where<T extends Model> static method
Filters records with comparison.
Supported: ==, !=, >, <, >=, <=
Implementation
static Future<List<T>> where<T extends Model>({
required String field,
String comp = "==",
required dynamic value,
}) async {
final constructor = _jsonConstructors[T];
if (constructor == null) return [];
try {
final maps = await _database.query(
_getTableName<T>(),
where: '$field $comp ?',
whereArgs: [value],
);
return maps.map((map) => constructor(map) as T).toList();
} catch (e) {
print('SQLite where error: $e');
return [];
}
}