AsyncLoadingBuilder class

A widget that builds itself based on the state of an asynchronous operation. It uses a FutureBuilder to manage the state of the asynchronous operation and provides a builder function that can be used to create the UI based on the current state (loading, error, or success).

This widget is useful for scenarios where you want to display ephemeral loading states. e.g. on buttons, where you want to show a loading indicator.

Inheritance
Available extensions

Constructors

AsyncLoadingBuilder({Key? key, Future<Object?>? initialFuture, required AsyncLoadingBuilderBuilder builder})
Creates an AsyncLoadingBuilder widget.
const

Properties

builder AsyncLoadingBuilderBuilder
A builder function that takes the current BuildContext, a boolean indicating whether the widget is currently loading, and a function to set a new future. The builder should return a widget that represents the current state of the asynchronous operation.
final
hashCode int
The hash code for this object.
no setterinherited
initialFuture Future<Object?>?
An optional initial future to be used when the widget is first built.
final
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

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<AsyncLoadingBuilder>
Creates the mutable state for this widget at a given location in the tree.
override
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
showAsDialog(BuildContext context, {bool useRootNavigator = false, ModalConfiguration configuration = const FadeScaleTransitionConfiguration()}) Future<T?>

Available on Widget, provided by the WidgetFS extension

Displays this widget as a dialog on screen
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

Static Methods

maybeOf<T>(BuildContext context) AsyncLoadingBuilderState?
Returns the AsyncLoadingBuilderState of the nearest AsyncLoadingBuilder ancestor.
of<T>(BuildContext context) AsyncLoadingBuilderState
Returns the AsyncLoadingBuilderState of the nearest AsyncLoadingBuilder ancestor.