Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: No StoreProvider<dynamic> found. #70

Closed
pierrederuel opened this issue Aug 8, 2018 · 3 comments
Closed

Error: No StoreProvider<dynamic> found. #70

pierrederuel opened this issue Aug 8, 2018 · 3 comments

Comments

@pierrederuel
Copy link

pierrederuel commented Aug 8, 2018

Hi,

I am using this boilerplate (https://github.com/FranPitri/flutter_redux_boilerplate) and when I try to access the store object to dispatch an action, for example

StoreProvider.of(context).dispatch(new UserLoginFailure("Ca marche pas"));

I get this error:

Error: No StoreProvider found. To fix, please try:
flutter: * Using Dart 2 (required) by using the --preview-dart-2 flag
flutter: * Wrapping your MaterialApp with the StoreProvider,
flutter: rather than an individual Route
flutter: * Providing full type information to your Store,
flutter: StoreProvider and StoreConnector<State, ViewModel>
flutter: * Ensure you are using consistent and complete imports.
flutter: E.g. always use `import 'package:my_app/app_state.dart';
I think this boilerplate project respects these requirements...

Have you got an idea?

Thanks a lot for your work,

Pierre

@brianegan
Copy link
Owner

Hey there -- sorry, on vacation at the moment. In this case, you need to provide more type information to the of method, or it infers your AppState class to be dynamic.

If you add the type info, all should be good, something like this:

StoreProvider.of<AppState>(context)

@brianegan
Copy link
Owner

Heya @pierrederuel -- did this solve your problem?

@pierrederuel
Copy link
Author

Hey Brian, sorry for replying so late but I had an issue with my internet connection. Yes the problem is solved, thanks a lot for your reply while you are on vacation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants