Firstly, I am not sure if this is a bug. I am confused between BlocProvider.value and BlocProvider create.
In this particular scenario I am creating and closing a bloc in a stateful widgets init and close method. So as per my understanding that suffices the condition of managing the lifecycle of the bloc
What is the expected behaviour if I call BlocProvider.create multiple times with the previously defined bloc instance inside that statefulwidget
In short what is the difference between
Scenario A:
BlocProvider(
// using the previously created bloc here
create: (context) =>_bloc,
child: widgetA,
BlocProvider(
// using the previously created bloc here
create: (context) =>_bloc,
child: widgetB
and Scenario B:
BlocProvider(
create: (context) =>_bloc,
child: widgetA,
BlocProvider.value(
value: (context) =>BlocProvider.of(pageContext),
child: widgetB
I am not clear on this. Any help would be highly appreciated. If you notice I am managing the lifecycle of the bloc separately So far I assumed both of these would lead to the same behaviour but I have been proved wronged recently. In my use case , using create twice is leading to "Bad state" even though the bloc.close() was never called. Replacing the secoond one with value constructor works just fine