Repository Data Source Router
Component Detail
Service Layer
high complexity
Shared Component
mobile
3
Dependencies
1
Dependents
2
Entities
0
Integrations
Description
Implements the repository pattern abstracting data source selection from feature-level BLoC/Riverpod state. Routes read operations to the local SQLite store first when offline, falling through to the REST API when online. Write operations always write to local SQLite and enqueue a sync mutation.
repository-router
Responsibilities
- Route read requests to local SQLite when offline, REST API when online
- Route write operations to local SQLite and enqueue sync mutations
- Provide a unified data access interface to feature repositories
- Handle local cache invalidation after successful remote sync
Interfaces
read<T>(query: LocalQuery): Future<T>
write<T>(entity: T, operation: MutationType): Future<void>
delete(entityId: String, entityType: String): Future<void>
isLocallyAvailable(entityType: String): bool
invalidateCache(entityType: String): Future<void>
seedLocalStore(entities: List<dynamic>): Future<void>
Relationships
Dependencies (3)
Components this component depends on
Related Data Entities (2)
Data entities managed by this component