diff --git a/packages/core/lib/state.dart b/packages/core/lib/state.dart index bbc3259..69d9794 100644 --- a/packages/core/lib/state.dart +++ b/packages/core/lib/state.dart @@ -177,6 +177,9 @@ abstract class PersistedState implements AsyncStateNotifier { try { rawV = await _store.getPersisted(_key); } on FormatException catch (e) { + // Addressing https://github.com/segmentio/analytics_flutter/issues/74 + // File corruption should be less likely with removal of async code in writes + // Existing corrupted files are cleaned up here without failing initialization _store.setPersisted(_key, {}); log("Clean file $_key with format error", kind: LogFilterKind.warning); final wrappedError = ErrorLoadingStorage(e);