WorkerMixin<T> mixin
A mixin that provides common functionality for building widgets from async snapshots.
This mixin handles the common pattern of building UI based on snapshot states:
- Data available and non-null: uses the builder
- Data is null or empty collection: uses emptyBuilder or default empty widget
- Error occurred: uses errorBuilder or default error widget
- Loading: uses loadingBuilder or default loading widget
- Mixin applications
Properties
- builder → Widget Function(BuildContext context, T data)
-
Builder invoked when non-null data is available.
no setter
- emptyBuilder → Widget Function(BuildContext context)?
-
Builder used when the data is null or considered empty.
no setter
- errorBuilder → Widget Function(BuildContext context, Object? error)?
-
Builder used when an error occurs.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- initialData → T?
-
Initial data to use while waiting for the first event.
no setter
- isProd → bool
-
Production mode flag.
no setter
- loadingBuilder → Widget Function(BuildContext context)?
-
Builder used while loading.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
buildFromSnapshot(
BuildContext context, AsyncSnapshot< T> snapshot) → Widget - Builds the appropriate widget based on the snapshot state.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited