Data Layer medium complexity mobile
0
Dependencies
2
Dependents
4
Entities
0
Integrations

Description

Local data layer managing cached badge definitions, earned badges, and progress state using BLoC/Riverpod state management. Handles optimistic updates on badge award, caches SVG badge assets for offline display, and synchronizes with the backend achievements and achievement_types tables.

Feature: Achievement Badges

achievement-store

Responsibilities

  • Cache badge definitions and earned badges locally
  • Manage badge state via BLoC/Riverpod providers
  • Store and serve cached SVG badge assets for offline access
  • Synchronize local badge state with backend on connectivity
  • Track and persist badge progress metrics locally

Interfaces

getCachedBadges(): List<Badge>
getCachedBadgeTypes(): List<AchievementType>
saveBadge(badge: Badge): Future<void>
saveBadgeTypes(types: List<AchievementType>): Future<void>
getProgress(badgeTypeId: String): BadgeProgress?
updateProgress(badgeTypeId: String, progress: BadgeProgress): Future<void>
cacheBadgeAsset(badgeTypeId: String, svgData: Uint8List): Future<void>
getBadgeAsset(badgeTypeId: String): Uint8List?
clearCache(): Future<void>
syncWithBackend(): Future<void>

Relationships

Dependents (2)

Components that depend on this component