mirror of
https://github.com/kuhyx/diet-guard.git
synced 2026-11-11 20:13:54 +01:00
Some checks are pending
dependency freshness / dependencies on newest stable (push) Waiting to run
file-length / file length <= 250 lines (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
pre-commit / pre-commit (push) Waiting to run
Tests / test (push) Waiting to run
release-apk / release (APK) (push) Waiting to run
Split out from the free-day change only by sequence -- diet-guard's pre-push CI mirror runs the freshness gate over --all-files, so these were already blocking a push before that work started. permission_handler 13.0.1 -> 13.0.2 and workmanager 0.10.9 -> 0.10.10 are patch bumps. very_good_analysis ^10.3.0 -> ^11.0.0 is the major one, and it newly flags 8 async_return_with_no_await sites across the desktop wrapper and the sync/Firebase services. Each is now `return await`, not a suppression. The rule is right in every one of these cases: without the await the future escapes the enclosing async function, so a rejection surfaces at the caller with a stack trace that no longer points at the code that made the call. background_check_service.dart:33 is the clearest example -- its own comment says the push "is retried with backoff rather than silently dropped", which is only true if the failure happens inside the function. Nothing in CI or pre-commit runs `flutter analyze`, so this would not have failed anything. Leaving a newly-red analyzer for the next person to find is how a repo stops being analyzable at all. flutter analyze clean, 706 Flutter tests pass. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
28 lines
929 B
Dart
28 lines
929 B
Dart
import 'package:crdt_sync/crdt_sync.dart';
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
/// Key holding the revision cache in `SharedPreferences`.
|
|
const kSyncStateKey = 'sync.state';
|
|
|
|
/// Opens the revision cache on web (the Chrome-wrapper desktop build).
|
|
///
|
|
/// `SharedPreferences` rather than IndexedDB: the payload is two short hashes
|
|
/// per peer, so a key-value entry is the whole requirement, and the inventory
|
|
/// log already owns the IndexedDB store.
|
|
Future<SyncStateStore> openSyncStateStore() async => PersistedSyncStateStore(
|
|
_PrefsPersistence(await SharedPreferences.getInstance()),
|
|
);
|
|
|
|
class _PrefsPersistence implements LogPersistence {
|
|
_PrefsPersistence(this._prefs);
|
|
|
|
final SharedPreferences _prefs;
|
|
|
|
@override
|
|
Future<String?> read() async => _prefs.getString(kSyncStateKey);
|
|
|
|
@override
|
|
Future<void> write(String text) async =>
|
|
await _prefs.setString(kSyncStateKey, text);
|
|
}
|