Hi Felix. Great work man. Thanks for contributing!
I've been using bloc in several projects but I think I'm possibly only scratching its surface. I always use the same pattern which is what you've documented in several places, e.g. https://medium.com/flutter-community/flutter-todos-tutorial-with-flutter-bloc-d9dd833f9df3
Today I like to use a nested bloc. Let me explain.
I have XBloc,
Inside XWidget (widget 1) I have some nesting of widgets which all require / could require XState (state 1) info, I can do so using BlocProvider.of
Now comes the question: inside XWidget I want the ability to create another XWidget (widget 2). This other XWidget has another XBloc with its own XState (state 2). If inside this nested XWidget I retrieve BlocProvider.of
thanks,
Eliud
Hi @eliudio 馃憢
Thanks for opening an issue and for the positive feedback!
Regarding your question, yes BlocProvider.of will always return the nearest bloc so in the nested case you will always get the second bloc instance 馃憤
Hope that helps!
Thanks