RemoteLoadCallback typedef
Callback function type for being notified when remote preferences load.
success indicates whether the load was successful.
attempt is the number of attempts made (starts at 1).
This is useful for:
- Updating UI when remote data becomes available
- Showing offline mode banners when loading fails
- Triggering data refresh in the app
Example:
Prefs.setRemoteLoadCallback((bool success, int attempt) {
if (success) {
print('✅ Remote prefs loaded on attempt $attempt');
// Update UI with fresh data
MyApp.refreshRemoteData();
} else {
print('❌ Failed after $attempt attempts');
// Show offline mode banner
MyApp.showOfflineBanner();
}
});
Implementation
typedef RemoteLoadCallback = void Function(bool success, int attempt);