Bloc: 6.0+ BlocProvider that wraps MaterialApp fails to be added to home widget's context

Created on 3 Sep 2020  路  3Comments  路  Source: felangel/bloc

Describe the bug
Per above:

App/build
BlocProvider => return MaterialApp(home: SomePage) => SomePage.Build => BlockBuilder throws.

To Reproduce
Steps to reproduce the behavior:

  1. in the root App Stateless Widget wrap the MaterialApp() in a blocprovider.
  2. In the home: of MaterialApp use a BlocBuilder to get the blocProvider's bloc
  3. BlocProvider.of() called with a context
  4. See error

Expected behavior
Should work like 5.0 worked and properly pass the provider through the material app.

question

Most helpful comment

Sorry, was on vacation.

I believe I found my issue. It was odd that it cropped up with V6 and wasn't there with the same code in V5. (had the bloc defined in multiple packages).

Thanks.

All 3 comments

Hi @JohnGalt1717 馃憢
Thanks for opening an issue!

Can you please provide a sample app which reproduces the issue? Thanks 馃憤

Closing for now since there isn't enough information to reproduce the issue. Feel free to comment with additional information or a sample app and I'm happy to continue the conversation 馃憤

Sorry, was on vacation.

I believe I found my issue. It was odd that it cropped up with V6 and wasn't there with the same code in V5. (had the bloc defined in multiple packages).

Thanks.

Was this page helpful?
0 / 5 - 0 ratings