find method
Find a record by ID
Implementation
Future<Model?> find(int id) async {
try {
Database db = await database;
final result = await db.rawQuery(
"SELECT * FROM $table WHERE id = ?",
[id],
);
if (result.isEmpty) return null;
return fromMap(result.first);
} catch (e) {
throw DatabaseException('Failed to find record with ID $id: $e');
}
}