Skip to content

Instantly share code, notes, and snippets.

@boeledi
Last active January 12, 2020 15:00
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 boeledi/e8ec399c35f47c8d9e6694c43a0b51b8 to your computer and use it in GitHub Desktop.
Save boeledi/e8ec399c35f47c8d9e6694c43a0b51b8 to your computer and use it in GitHub Desktop.
class MyTree extends StatefulWidget {
@override
_MyTreeState createState() => _MyTreeState();
}
class _MyTreeState extends State<MyTree>{
MyBloc bloc;
@override
void initState(){
super.initState();
bloc = MyBloc();
}
@override
void dispose(){
bloc?.dispose();
super.dispose();
}
@override
Widget build(BuildContext context){
return BlocProvider<MyBloc>(
blocBuilder: () => bloc,
blocDispose: (){},
child: Column(
children: <Widget>[
MyChildWidget(),
],
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment