Activity Service
Component Detail
Service Layer
medium complexity
mobile
2
Dependencies
7
Dependents
4
Entities
0
Integrations
Description
Core business logic service for activity registration. Handles activity CRUD operations, fetches and caches the activity type catalogue, injects smart default form values, and coordinates between the UI layer and both the local Drift database and the remote REST API. Implemented as a Riverpod provider.
activity-service
Responsibilities
- Provide the activity type catalogue from local Drift cache or REST API, refreshing on connectivity
- Persist new activity records to the local Activities Table and mutation outbox for offline-first submission
- Compute and expose default form values (current date, 30-minute duration) at widget initialisation
- Expose Riverpod AsyncNotifier providers for activity form state, submission status, and activity list
- Propagate completed mutations to the backend when connectivity is restored via the shared sync queue
Interfaces
getActivityTypes() → Future<List<ActivityType>>
logActivity(ActivityFormData data) → Future<void>
getActivities({required String userId}) → Future<List<Activity>>
deleteActivity(String activityId) → Future<void>
getDefaultFormValues() → ActivityFormDefaults
activityTypesProvider → AsyncNotifier<List<ActivityType>>
activityFormProvider → StateNotifier<ActivityFormState>
Relationships
Dependencies (2)
Components this component depends on
Dependents (7)
Components that depend on this component
Related Data Entities (4)
Data entities managed by this component