diff --git a/packages/core/lib/state.dart b/packages/core/lib/state.dart index 48632ba..8c376f7 100644 --- a/packages/core/lib/state.dart +++ b/packages/core/lib/state.dart @@ -201,9 +201,16 @@ abstract class PersistedState implements AsyncStateNotifier { return; }).catchError((e) { _error = e; - final wrappedError = ErrorLoadingStorage(e); - errorHandler(wrappedError); - throw wrappedError; + // Clean file if exist a format error + if(_error.toString().contains("FormatException")) { + _store.setPersisted(_key, {}); + log("Clean file $_key with format error", + kind: LogFilterKind.warning); + } else { + final wrappedError = ErrorLoadingStorage(e); + errorHandler(wrappedError); + throw wrappedError; + } }); }