get Routes For Dashboard
Get dashboard routes with intelligent cache-first strategy for single-date queries.
This method implements advanced offline-first caching for dashboard route views:
Cache Threshold: Up to 10 routes are cached for instant access
Cache Window: Single dates within a 7-day window (today ± 3 days) are cacheable
Background Sync: Cached data is returned immediately, with background refresh
Automatic Updates: Use observeDashboardChanges to receive real-time updates
Cacheable Criteria (all must be true):
Page 1 requested
Single date (fromDate == toDate)
Date within 7-day window (today ± 3 days)
Non-cacheable requests (multi-date, out-of-window, page 2+) use API-only path.
Sync States:
FULL: Complete dataset cached (≤10 routes) - returns cache immediately with background sync
PARTIAL: Incomplete dataset (>10 routes exist) - attempts API with timeout, falls back to cache
PENDING: No data cached yet - attempts API without timeout
Return
GetDashboardRoutesResult with routes and isPartialData flag indicating cache vs API
Parameters
Page number for pagination (1-based)
Number of routes per page
Start date in ISO format (YYYY-MM-DD)
End date in ISO format (YYYY-MM-DD)
Optional flag to include polyline data (default: false for performance)