Created
July 9, 2019 02:42
-
-
Save felangel/433cfade7184599013e4c9d29d065e1a to your computer and use it in GitHub Desktop.
[flutter_bloc_0.19.0] Repository Provider default constructor
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
class MyWidget extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return RepositoryProvider( | |
builder: (context) => MyRepository(), | |
child: MyChild(), | |
); | |
} | |
} | |
class MyChild extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return BlocProvider( | |
builder: (context) => MyBloc(RepositoryProvider.of<MyRepository>(context)), | |
child: MyOtherChild(), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment