final persistor = Persistor(
storage: FlutterStorage(key: "GMWAN_AppState.json", location: FlutterSaveLocation.sharedPreferences), // Or use other engines
serializer: JsonSerializer(GMWAN_AppState.fromJson), // Or use other serializers
);
Above is my main method. The thunk middle ware is an async network call that builds a list on response.
[VERBOSE-2:shell.cc(186)] Dart Error: Unhandled exception:
SerializationException: On load: Concurrent modification during iteration: Instance(length:3) of '_GrowableList'.
#1 main (package:gmwan/GMWAN_Redux/mainRedux.dart:37:40)
#2 _startIsolate. (dart:isolate/runtime/libisolate_patch.dart:289:19)
#3 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
Please advise on what i should do to fix this error. Thank you!
void main() async{
final persistor = Persistor(
storage: FlutterStorage(key: "GMWAN_AppState.json", location: FlutterSaveLocation.sharedPreferences), // Or use other engines
serializer: JsonSerializer(GMWAN_AppState.fromJson), // Or use other serializers
);
// Load initial state /*
final initalStateCompleter = Completer();
persistor.load().then((store){ initalStateCompleter.complete(store); }).catchError((c){ print('ERRRRROOOOOORRRRRRR--------------------------------------------'); initalStateCompleter.complete(GMWAN_AppState(userState: ParticleUserState(user: ParticleUser.notLoggedIn()),infoCardsState: InfoCardsState())); });
*/
final initialState = await persistor.load();
final store = new Store(
appStateReducer,
initialState:
initialState ?? GMWAN_AppState(userState: ParticleUserState(user: ParticleUser.notLoggedIn()),infoCardsState: InfoCardsState()),
middleware: [thunkMiddleware, persistor.createMiddleware()]);
runApp(StoreProvider(
child: MyApp(),
store: store,
));
}
Above is my main method. The thunk middle ware is an async network call that builds a list on response.
[VERBOSE-2:shell.cc(186)] Dart Error: Unhandled exception: SerializationException: On load: Concurrent modification during iteration: Instance(length:3) of '_GrowableList'.
0 Persistor.load (package:redux_persist/src/persistor.dart:131:7)