MultiRepositoryProvider class
Merges multiple RepositoryProvider widgets into one widget tree.
MultiRepositoryProvider improves the readability and eliminates the need to nest multiple RepositoryProviders.
By using MultiRepositoryProvider we can go from:
RepositoryProvider<RepositoryA>(
create: (context) => RepositoryA(),
child: RepositoryProvider<RepositoryB>(
create: (context) => RepositoryB(),
child: RepositoryProvider<RepositoryC>(
create: (context) => RepositoryC(),
child: ChildA(),
)
)
)
to:
MultiRepositoryProvider(
providers: [
RepositoryProvider<RepositoryA>(create: (context) => RepositoryA()),
RepositoryProvider<RepositoryB>(create: (context) => RepositoryB()),
RepositoryProvider<RepositoryC>(create: (context) => RepositoryC()),
],
child: ChildA(),
)
MultiRepositoryProvider converts the RepositoryProvider list into a tree of nested RepositoryProvider widgets. As a result, the only advantage of using MultiRepositoryProvider is improved readability due to the reduction in nesting and boilerplate.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- Nested
- MultiRepositoryProvider
- Implemented types
- Available extensions
Constructors
-
MultiRepositoryProvider({required List<
SingleChildWidget> providers, required Widget child, Key? key}) - Merges multiple RepositoryProvider widgets into one widget tree.
Properties
- center → Widget
-
Available on Widget, provided by the WidgetX extension
no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
align(
Alignment alignment) → Widget -
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
inherited
-
createElement(
) → _NestedElement -
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
-
pad(
double pad) → Widget -
pOnly(
{double left = 0, double top = 0, double right = 0, double bottom = 0}) → Widget -
pxy(
{double x = 0, double y = 0}) → Widget -
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, int wrapWidth = 65}) → 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
-
visible(
{required bool isVisible, Widget replacer = const SizedBox.shrink()}) → Widget
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited