LAsyncView<T> class

A specialized view for asynchronous dependencies.

LAsyncView resolves a Future dependency and renders loading, error, or builder (success) states. The resolution logic is memoized to prevent infinite re-fetching.

Use args to forcefully re-trigger the resolution when arguments change.

Inheritance

Constructors

LAsyncView({Key? key, Future<T> resolver(BuildContext context)?, Widget builder(BuildContext context, T controller)?, bool autoWatch = true, Widget loading(BuildContext context)?, Widget error(BuildContext context, Object error)?, List<Object?>? args})
Creates an async view.
const
LAsyncView.put(Future<T> create(), {Key? key, String? tag, bool permanent = false, bool isFactory = false, required Widget builder(BuildContext context, T controller), bool autoWatch = true, Widget loading(BuildContext context)?, Widget error(BuildContext context, Object error)?, List<Object?>? args})
Registers an async dependency of type T and consumes it.
factory
LAsyncView.store(LevitAsyncStore<T> store, {Key? key, required Widget builder(BuildContext context, T controller), bool autoWatch = true, Widget loading(BuildContext context)?, Widget error(BuildContext context, Object error)?, List<Object?>? args})
Syntax sugar for consuming a LevitAsyncStore.
factory

Properties

args List<Object?>?
Optional dependency keys for re-resolution.
final
autoWatch bool
Whether to wrap the view in an LWatch.
final
builder Widget Function(BuildContext context, T controller)?
Builds the widget tree using the resolved controller.
final
error Widget Function(BuildContext context, Object error)?
Builder for the error state.
final
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 Function(BuildContext context)?
Builder for the loading state.
final
resolver Future<T> Function(BuildContext context)?
Resolves the dependency asynchronously from the context.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

buildError(BuildContext context, Object err) Widget
buildLoading(BuildContext context) Widget
buildView(BuildContext context, T controller) Widget
Builds the view content for the given controller.
createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<LAsyncView<T>>
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
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