LocalDiaryDatabase class
A local SQLite-backed database for storing DiaryEntry and DiaryCard data.
This database supports:
- Offline persistence of diary entries.
- Automatic cleanup of oldest entries beyond a configurable maxEntries.
- Conversion from Firestore-like models to local-friendly formats.
- Lazy location resolution via GeolocatorService.
Constructors
- LocalDiaryDatabase({int maxEntries = 10})
- Creates a LocalDiaryDatabase instance.
Properties
-
database
→ Future<
Database> -
Returns the active Database instance, initializing it if needed.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- maxEntries → int
-
Maximum number of entries to store per user.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
deleteEntry(
String id) → Future< void> -
Deletes a diary entry by its
id
. -
getAllEntries(
{required String userId}) → Future< List< DiaryEntry> > - Retrieves all DiaryEntrys for a given user, ordered by most recent date.
-
getDiaryCardsFromLocalDb(
{required String userId, required int limit, required int offset}) → Future< List< DiaryCard> > - Retrieves a paginated list of DiaryCards for preview display.
-
getEntryById(
String id) → Future< DiaryEntry?> -
Returns a specific DiaryEntry by its
id
, or null if not found. -
insertEntry(
DiaryEntry entry, String userId, String optionalLocation) → Future< void> - Inserts a DiaryEntry into the local database for a specific user.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited