Activity BLoC
Component Detail
Infrastructure
medium complexity
mobile
1
Dependencies
0
Dependents
1
Entities
0
Integrations
Description
BLoC (Business Logic Component) state management layer for the activity logging flow. Translates UI events (form field changes, submission taps, type selection) into state transitions and delegates business logic to ActivityService. Manages loading, validation error, success, and offline states so the UI remains purely declarative. Subscribes to SyncService status stream to update UI when background sync completes.
activity-bloc
Responsibilities
- Map UI events to ActivityService calls and emit corresponding states
- Manage form validation state (field errors, overall validity)
- Handle optimistic submission and background sync status updates
- Provide offline/online status awareness to the UI layer
Interfaces
ActivityTypeSelectedEvent(ActivityType type)
ActivityFormChangedEvent(ActivityFormData data)
ActivitySubmitEvent()
ActivityResetEvent()
ActivityLoadingState()
ActivitySuccessState(Activity activity)
ActivityErrorState(String message)
ActivityValidationState(Map<String, String> errors)