-
-
Save boeledi/070f32aa3534d82669c7150447e900a1 to your computer and use it in GitHub Desktop.
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 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(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, I want to make some suggestion.
I think line 18 should be
MyBloc bloc = BlocProvider.of(context);
variable name is missing :(