Created
May 28, 2020 09:42
-
-
Save GIfatahTH/6dc73968c77222331bf5a9d01028c8e5 to your computer and use it in GitHub Desktop.
states_rebuilder_shopper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Injector( | |
inject: [ | |
// Inject the CatalogState. | |
Inject<CatalogState>( | |
// The starting state is CatalogInitialState | |
() => CatalogInitialState(CatalogRepository()), | |
), | |
//Inject CartState with initial state of empty items | |
Inject<CartState>(() => CartState(items: [])), | |
], | |
builder: (context) => MaterialApp( | |
title: 'Provider Demo', | |
theme: appTheme, | |
initialRoute: '/', | |
routes: { | |
'/': (context) => MyCatalog(), | |
'/cart': (context) => MyCart(), | |
}, | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment