Skip to content

Instantly share code, notes, and snippets.

@boeledi
Last active March 27, 2023 13:47
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/070f32aa3534d82669c7150447e900a1 to your computer and use it in GitHub Desktop.
Save boeledi/070f32aa3534d82669c7150447e900a1 to your computer and use it in GitHub Desktop.
class MyTree extends StatelessWidget {
@override
Widget build(BuildContext context){
return BlocProvider<MyBloc>(
blocBuilder: () => MyBloc(),
child: Column(
children: <Widget>[
MyChildWidget(),
],
),
);
}
}
class MyChildWidget extends StatelessWidget {
@override
Widget build(BuildContext context){
MyBloc? myBloc = BlocProvider.of<MyBloc>(context);
return Container();
}
}
@chinapoopoo
Copy link

Hi, I want to make some suggestion.
I think line 18 should be
MyBloc bloc = BlocProvider.of(context);
variable name is missing :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment