Dear all,
I saw the problem when use redux with getx .
======== Exception caught by widgets library =======================================================
The following StoreProviderError<StoreProvider<AppState>> was thrown building StoreConnector<AppState, AuthenViewModel>(dirty):
Error: No StoreProvider<AppState> found. To fix, please try:
* Wrapping your MaterialApp with the StoreProvider<State>,
rather than an individual Route
* Providing full type information to your Store<State>,
StoreProvider<State> and StoreConnector<State, ViewModel>
* Ensure you are using consistent and complete imports.
E.g. always use `import 'package:my_app/app_state.dart';
If none of these solutions work, please file a bug at:
https://github.com/brianegan/flutter_redux/issues/new
============================================
My source code
void main() async {
WidgetsFlutterBinding.ensureInitialized();
//TODO create store
var store = await createStore();
await Hive.initFlutter();
await Hive.openBox(nameDatabase);
await Firebase.initializeApp();
CacheDataManager.getInstance().delete(Constants.DataAppConfig);
setupLocator();
WidgetsFlutterBinding.ensureInitialized();
// SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
// // statusBarColor: Colors.transparent, // transparent status bar
// statusBarIconBrightness: Brightness.light,
// statusBarBrightness: Brightness.light,
//
// ));
return runApp(GetMaterialApp(home: MyApp(store: store,),));
}
class MyApp extends StatelessWidget{
// This widget is the root of your application.
final Store<AppState> store;
const MyApp({Key key, this.store}) : super(key: key);
@override
Widget build(BuildContext context) {
return ScreenUtilInit(
designSize: Size(360, 690),
builder: () => StoreProvider<AppState>(
store: store,
child: MaterialApp(
title: 'Playfun',
navigatorKey: GlobalVariable.navState,
theme: ThemeData(
primarySwatch: Colors.orange,
// brightness: Brightness.light
),
initialRoute: '/',
navigatorObservers: [locator<TrackingService>().getAnalyticsObserver()],
routes: {
'/': (context) => SplashScreen(),
},
// home: MainScreen(),
),
)
);
Dear all, I saw the problem when use redux with getx .
============================================ My source code
} }