IsolateBlocProvider<T extends IsolateBlocBase<Object?, State> , State>.value constructor
IsolateBlocProvider<T extends IsolateBlocBase<Object?, State> , State>.value ({
- Key? key,
- required IsolateBlocWrapper<
Object?> value, - Widget? child,
Takes a bloc
and a child which will have access to the bloc
via
IsolateBlocProvider.of(context)
.
When IsolateBlocProvider.value
is used, the bloc
will not be automatically
closed.
As a result, IsolateBlocProvider.value
should mainly be used for providing
existing bloc
s to new routes.
A new bloc
should not be created in IsolateBlocProvider.value
.
bloc
s should always be created using the default constructor within
create
.
IsolateBlocProvider.value(
value: IsolateBlocProvider.of<BlocA, BlocAState>(context),
child: ScreenA(),
);
Implementation
IsolateBlocProvider.value({
Key? key,
required IsolateBlocWrapper<Object?> value,
this.child,
}) : _value = value,
lazy = null,
super(key: key, child: child);