BlocScope<T extends IStateObservable<Object?> >.value constructor
BlocScope<T extends IStateObservable<Object?> >.value ({})
Takes a value
and a child which will have access to the value
via
BlocScope.of(context)
.
When BlocScope.value
is used, the Bloc
will not be automatically closed.
As a result, BlocScope.value
should only be used for providing
existing instances to new subtrees.
A new Bloc should not be created in BlocScope.value
.
New instances should always be created using the
default constructor within the Create function.
BlocScope.value(
value: BlocScope.of<BlocA>(context),
child: ScreenA(),
);
Implementation
BlocScope.value({
required T value,
this.child,
Key? key,
}) : _value = value,
_create = null,
super(key: key);