Created
July 9, 2019 02:21
-
-
Save felangel/bcb2fdbcb1f88547e29c2665fe5baa40 to your computer and use it in GitHub Desktop.
[flutter_bloc_0.19.0] Old BlocProvider
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 StatefulWidget { | |
State<MyWidget> createState() => _MyWidgetState(); | |
} | |
class _MyWidgetState extends State<MyWidget> { | |
MyBloc _myBloc; | |
@override | |
void initState() { | |
super.initState(); | |
_myBloc = MyBloc(); | |
} | |
@override | |
Widget build(BuildContext context) { | |
return BlocProvider( | |
bloc: _myBloc, | |
child: MyChild(), | |
); | |
} | |
@override | |
void dispose() { | |
_myBloc.dispose(); | |
super.dispose(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment