flutter_redux_boilerplate icon indicating copy to clipboard operation
flutter_redux_boilerplate copied to clipboard

Issues with latest redux and flutter persist packages

Open nathandaly opened this issue 5 years ago • 2 comments

Firstly I really like your folder structure.

I am trying to update this with the latest redux and redux persist and think there are some breaking changes including the line below where it does not recognise PersistLoadedAction:

https://github.com/FranPitri/flutter_redux_boilerplate/blob/master/lib/reducers/app_reducer.dart#L8

I also had to swap out decoder with serializer in the Persistor definition.

Do you have a branch of this project using the latest versions and if not do you know how to correct the above issue?

Thanks in advance Nathan

nathandaly avatar Dec 23 '19 10:12 nathandaly

Hi @FranPitri @nathandaly , I'm having the same issue. Here is the error:

[VERBOSE-2:ui_dart_state.cc(148)] Unhandled Exception: StorageException: load: ServicesBinding.defaultBinaryMessenger was accessed before the binding was initialized. If you're running an application and need to access the binary messenger before runApp() has been called (for example, during plugin initialization), then you need to explicitly call the WidgetsFlutterBinding.ensureInitialized() first. If you're running a test, you can call the TestWidgetsFlutterBinding.ensureInitialized() as the first line in your test's main() method to initialize the binding. #0 Persistor.load (package:redux_persist/redux_persist.dart:117:7) #1 Persistor.start (package:redux_persist/redux_persist.dart:91:38) #2 createStore (package:flutter_redux_boilerplate/store/store.dart:13:15) #3 new ReduxApp (package:flutter_redux_boilerplate/main.dart:17:19) #4 main (package:flutter_redux_boilerplate/main.dart:14:27) #5 _runMainZoned..<anonymous <…>

Can you do something or guide us to the solution please?

Thanks

Pierre

pierrederuel avatar Jan 09 '20 10:01 pierrederuel

Same problem since I updated flutter:

I/flutter ( 6035): Failed to load initial data: StorageException: On load: ServicesBinding.defaultBinaryMessenger was accessed before the binding was 
initialized.
I/flutter ( 6035): If you're running an application and need to access the binary messenger before `runApp()` has been called (for example, during plugin initialization), then you need to explicitly call the `WidgetsFlutterBinding.ensureInitialized()` first.
I/flutter ( 6035): If you're running a test, you can call the `TestWidgetsFlutterBinding.ensureInitialized()` as the first line in your test's `main()` method to initialize the binding.
E/flutter ( 6035): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: NoSuchMethodError: The method 'dispatch' was called on null.
E/flutter ( 6035): Receiver: null
E/flutter ( 6035): Tried calling: dispatch(Instance of 'AddErrorAction')
E/flutter ( 6035): #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5)
E/flutter ( 6035): #1      main (package:ng_sales_rep_app/main.dart:20:14)
E/flutter ( 6035): <asynchronous suspension>
E/flutter ( 6035): #2      _runMainZoned.<anonymous closure>.<anonymous closure> (dart:ui/hooks.dart:239:25)
E/flutter ( 6035): #3      _rootRun (dart:async/zone.dart:1126:13)
E/flutter ( 6035): #4      _CustomZone.run (dart:async/zone.dart:1023:19)
E/flutter ( 6035): #5      _runZoned (dart:async/zone.dart:1518:10)
E/flutter ( 6035): #6      runZoned (dart:async/zone.dart:1502:12)
E/flutter ( 6035): #7      _runMainZoned.<anonymous closure> (dart:ui/hooks.dart:231:5)
E/flutter ( 6035): #8      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:307:19)
E/flutter ( 6035): #9      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)

lucien-theron avatar Jan 29 '20 13:01 lucien-theron