MultiResourceBuilder<E> class
A powerful builder widget that coordinates multiple Resource states into a single, unified view.
This builder acts as a composite screen orchestrator. It aggregates the states of all provided resources to determine whether to show a global full-page error, a global empty state, or allow the individual resources to render their success/skeleton states.
For selective rebuilds, provide a ResourceDef.selectorBuilder on each
resource to wrap it in your state management's selector (e.g., BlocSelector,
Provider's Selector). Only the resource that changed will rebuild.
All children are rendered as slivers within a single CustomScrollView.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- MultiResourceBuilder
Constructors
-
MultiResourceBuilder({Key? key, required List<
ResourceDef< standards, Widget resourcesSelector(Widget childBuilder(BuildContext context, List<dynamic, E> >Resource< aggregateResources))?, E? globalError, PaginatedResourceDef<dynamic, E> >dynamic, dynamic, E> ? paginated, Widget? loading, Widget error(BuildContext context, E error)?, Widget? empty, VoidCallback? onRetry, Future<void> onRefresh()?, bool useSkeleton = true})
Properties
- empty → Widget?
-
finalinherited
- error → Widget Function(BuildContext context, E error)?
-
finalinherited
- globalError → E?
-
The error to return if all resources fail.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- loading → Widget?
-
finalinherited
-
onRefresh
→ Future<
void> Function()? -
finalinherited
- onRetry → VoidCallback?
-
finalinherited
-
paginated
→ PaginatedResourceDef<
dynamic, dynamic, E> ? -
An optional paginated resource to render at the bottom of the list.
final
-
resourcesSelector
→ Widget Function(Widget childBuilder(BuildContext context, List<
Resource< aggregateResources))?dynamic, E> > -
Optional selector builder that wraps the entire builder in a
state-management selector widget.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
standards
→ List<
ResourceDef< dynamic, E> > -
A list of standard, non-paginated resources to render as slivers.
final
- useSkeleton → bool
-
Whether to use skeletons (shimmer effect) when resources are in their
initial loading state. If false, individual loading widgets are shown.
final
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
buildInternal(
BuildContext context, List< Resource< aggregateResources, List<dynamic, E> >Widget> slivers) → Widget -
inherited
-
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, 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
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited