Describe the bug
When showing a dialog and sharing the old bloc with the new context tree, it will work correctly when using BlocProvider.value, but not when including it in MultiBlocProvider.
To Reproduce
Works:
showDialog(
context: context,
builder: (_) {
return BlocProvider.value(
value: BlocProvider.of<A>(context),
child: MultiBlocProvider(providers: <BlocProvider>[
BlocProvider<B>(
create: (BuildContext context) => B(),
),
BlocProvider<C>(
create: (BuildContext context) => C()
], child: S()));
});
Not working:
showDialog(
context: context,
builder: (_) {
return MultiBlocProvider(providers: <BlocProvider>[
BlocProvider.value(
value: BlocProvider.of<A>(context)),
BlocProvider<B>(
create: (BuildContext context) => B(),
),
BlocProvider<C>(
create: (BuildContext context) => C()
], child: S()));
});
Hi @polivmi1 馃憢
Thanks for opening an issue!
When using MultiBlocProvider you just explicitly specify the bloc type
BlocProvider<B>.value(...)
Hope that helps 馃憤
Most helpful comment
Hi @polivmi1 馃憢
Thanks for opening an issue!
When using MultiBlocProvider you just explicitly specify the bloc type
BlocProvider<B>.value(...)Hope that helps 馃憤