Statistics BLoC
Component Detail
Service Layer
medium complexity
mobile
1
Dependencies
0
Dependents
0
Entities
0
Integrations
Description
Flutter BLoC (or Riverpod notifier) that manages filter state and async data loading for the personal statistics dashboard. Handles events for period selection, activity type filtering, and retry, mapping them to API calls via the Statistics Service.
statistics-bloc
Responsibilities
- Hold and update DateRange and ActivityType filter state
- Emit loading / loaded / error states to the UI
- Debounce filter changes to avoid excessive API calls
- Trigger cache-based fallback on network failure
Interfaces
add(StatsEvent event)
StatsState get state
Stream<StatsState> get stream
onPeriodChanged(StatsPeriod)
onActivityTypeChanged(String?)
onRetryRequested()
close()