getEntryById method
- String id
Returns a specific DiaryEntry by its id
, or null if not found.
Implementation
Future<DiaryEntry?> getEntryById(String id) async {
final db = await database;
final result = await db.query(
'diary_entries',
where: 'id = ?',
whereArgs: [id],
);
if (result.isNotEmpty) {
return DiaryEntry.fromJson(result.first);
} else {
return null;
}
}