🎯 Goal
Ensure that caregiver-related data (e.g., shared baby profiles) is synchronized from Firestore to local database up to 3 times per day.
This ensures consistent and up-to-date caregiver access across multiple devices without requiring real-time syncing, reducing performance costs.
🧩 Context
- In Sara Baby, a baby can be shared among multiple users (caregivers)
- Each user’s local database (e.g. SQLite) stores baby + caregiver data
- When a user makes changes (e.g., adds an activity), a local-to-cloud sync occurs every 15 seconds
- However, changes made by other caregivers on Firestore aren't reflected unless the app explicitly pulls data from Firestore
✅ Tasks
🧪 Test Scenarios
🔧 Tech Suggestions
- Use
SQLite to store last sync timestamps
- Use BLoC or Repository to trigger sync from AppLifecycle or HomePage
- Consider future use of
workmanager or flutter_background_fetch for automated scheduling
🎯 Goal
Ensure that caregiver-related data (e.g., shared baby profiles) is synchronized from Firestore to local database up to 3 times per day.
This ensures consistent and up-to-date caregiver access across multiple devices without requiring real-time syncing, reducing performance costs.
🧩 Context
✅ Tasks
Add a sync frequency limiter
SQLiteor similar to store timestamps of last 3 syncsSchedule sync on key app events:
On sync trigger:
Ensure sync logic is idempotent (running it multiple times doesn’t duplicate or corrupt data)
🧪 Test Scenarios
🔧 Tech Suggestions
SQLiteto store last sync timestampsworkmanagerorflutter_background_fetchfor automated scheduling