marcglasberg / async_redux

Flutter Package: A Redux version tailored for Flutter, which is easy to learn, to use, to test, and has no boilerplate. Allows for both sync and async reducers.
Other
234 stars 40 forks source link

Error: No StoreProvider<AppState> found. (debug info: Null) #111

Closed huoda1237 closed 3 years ago

huoda1237 commented 3 years ago

The following StoreConnectorError was thrown building StoreConnector<AppState, SignInViewModel>(dirty): Error: No StoreProvider found. (debug info: Null)

To fix, please try:

The relevant error-causing widget was StoreConnector<AppState, SignInViewModel> lib/…/sign_in/sign_in_connector.dart:13 When the exception was thrown, this was the stack

0 StoreProvider.of

package:async_redux/src/store.dart:766

1 StoreConnector.build

package:async_redux/src/store.dart:950

2 StatelessElement.build

package:flutter/…/widgets/framework.dart:4569

3 ComponentElement.performRebuild

packa

huoda1237 commented 3 years ago

你好,我是来自中国的朋友,当我运行这个demo的时候遇到了上面的问题,请帮我分析下是什么原因,谢谢

marcglasberg commented 3 years ago

It's saying it couldn't find a StoreProvider<AppState> in the tree above one of your store connector widgets.

Up in your tree you must have this:

StoreProvider<AppState>(
      store: myStore,
      child: MaterialApp( ...

If you want to get more information from the error message, you can pass the debug: this parameter to all your store connectors. For example:

return StoreConnector<AppState, SignInViewModel>(
     debug: this,

Then, instead of (debug info: Null) you will get the name of the store connector which is failing.