RxMultiBlocProvider class
Merges multiple BlocProvider widgets into one widget tree.
RxMultiBlocProvider improves the readability and eliminates the need to nest multiple RxBlocProviders.
By using RxMultiBlocProvider we can go from:
RxBlocProvider<BlocA>(
create: (BuildContext context) => BlocA(),
child: RxBlocProvider<BlocB>(
create: (BuildContext context) => BlocB(),
child: RxBlocProvider<BlocC>(
create: (BuildContext context) => BlocC(),
child: ChildA(),
)
)
)
to:
RxMultiBlocProvider(
providers: [
RxBlocProvider<BlocA>(
create: (BuildContext context) => BlocA(),
),
RxBlocProvider<BlocB>(
create: (BuildContext context) => BlocB(),
),
RxBlocProvider<BlocC>(
create: (BuildContext context) => BlocC(),
),
],
child: ChildA(),
)
RxMultiBlocProvider converts the RxBlocProvider list into a tree of nested RxBlocProvider widgets. As a result, the only advantage of using RxMultiBlocProvider is improved readability due to the reduction in nesting and boilerplate.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- RxMultiBlocProvider
Constructors
-
RxMultiBlocProvider({required List<
RxBlocProvider< providers, required Widget child, Key? key})RxBlocTypeBase> > -
Merges multiple BlocProvider widgets into one widget tree.
const
Properties
- child → Widget
-
The widget and its descendants which will have access to every bloc
provided by providers.
child will be a direct descendent of
the last RxBlocProvider in providers.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
-
providers
→ List<
RxBlocProvider< RxBlocTypeBase> > -
The RxBlocProvider list which is converted into a tree
of RxBlocProvider widgets.
The tree of RxBlocProvider widgets is created in order meaning
the first RxBlocProvider
will be the top-most RxBlocProvider and the last RxBlocProvider
will be a direct ancestor
of child.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited