RxBlocProvider<T extends RxBlocTypeBase>.value constructor
Takes a bloc
and a child
which will have access to the bloc
via RxBlocProvider.of(context)
.
When RxBlocProvider.value
is used, the bloc
will not be
automatically disposed.
As a result, RxBlocProvider.value
should mainly be used for
providing existing bloc
s
to new routes.
A new bloc
should not be created in RxBlocProvider.value
.
bloc
s should always be created using the default constructor
within create
.
RxBlocProvider.value(
value: RxBlocProvider.of<BlocA>(context),
child: ScreenA(),
);
Implementation
RxBlocProvider.value({
required T value,
Key? key,
Widget? child,
}) : this._(
key: key,
create: (_) => value,
child: child,
);