Skip to content

Instantly share code, notes, and snippets.

@felangel
Created July 9, 2019 02:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save felangel/bcb2fdbcb1f88547e29c2665fe5baa40 to your computer and use it in GitHub Desktop.
Save felangel/bcb2fdbcb1f88547e29c2665fe5baa40 to your computer and use it in GitHub Desktop.
[flutter_bloc_0.19.0] Old BlocProvider
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