find<T extends Model> static method
Finds record by primary key (id).
Implementation
static Future<T?> find<T extends Model>({required int id}) async {
try {
final constructor = _jsonConstructors[T];
if (constructor == null) return null;
final maps = await _database.query(_getTableName<T>(), where: 'id = ?', whereArgs: [id], limit: 1);
if (maps.isNotEmpty) {
return constructor(maps.first) as T;
}
return null;
} catch (e) {
print('SQLite find error: $e');
return null;
}
}