syncOnLaunch method
Syncs preferences with the cloud on app launch.
If local changes were not uploaded (dirty flag set), syncs up first to avoid overwriting them. Then syncs down to pull any cloud changes. No-op if not logged in.
Implementation
Future<void> syncOnLaunch() async {
try {
if (await _dirty) await syncUp();
await syncDown();
} on NotLoggedInException {
return;
}
}