Note Autosave Service
Component Detail
Service Layer
medium complexity
mobile
1
Dependencies
1
Dependents
1
Entities
0
Integrations
Description
BLoC or Riverpod notifier that listens to text change events from the Note Editor Screen and triggers debounced write operations to prevent data loss. Persists drafts to local SQLite via the offline-sync subsystem before syncing to the backend REST API, and emits observable save-status events back to the UI.
note-autosave-service
Responsibilities
- Debounce text change events and trigger save after a configurable idle period
- Write note drafts to local SQLite for offline resilience before backend sync
- Sync confirmed drafts to the backend REST API notes endpoint
- Emit save status stream (idle, saving, saved, error) consumed by the editor UI
- Handle concurrent session conflicts by detecting stale version on update response
Interfaces
onTextChanged(String text)
saveNow() -> Future<void>
discardDraft(String? noteId)
Stream<SaveStatus> saveStatusStream