AsyncPod<T> class
An extended WhalePod dedicated to managing asynchronous state. This tracks whether a network request or heavy operation is loading, successful, or failed, enabling the obx pattern from GetX.
- Inheritance
-
- Object
- ChangeNotifier
- WhalePod<
T?> - AsyncPod
- Available extensions
Constructors
- AsyncPod([T? initialValue])
Properties
- error → Object?
-
Returns the current error object if status == error.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- status → AsyncStatus
-
Current status of the pod execution.
no setter
- value ↔ T?
-
The current value of the object. When the value changes, the callbacks
registered with addListener will be invoked.
getter/setter pairinherited
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
call(
[dynamic newValue = _marker]) → T? -
Callable support! e.g.
counter()to get, andcounter(10)to set.inherited -
debounce(
Duration duration, void callback(T value)) → VoidCallback -
Available on WhalePod<
CallsT> , provided by the PodWorkers extensioncallbackwhen the value changes, but only afterdurationhas passed without any further changes. Extremely useful for search fields to avoid spamming an API. -
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
inherited
-
ever(
void callback(T value)) → VoidCallback -
Available on WhalePod<
CallsT> , provided by the PodWorkers extensioncallbackevery time the value changes. Returns a function that cancels the listener. -
interval(
Duration duration, void callback(T value)) → VoidCallback -
Available on WhalePod<
CallsT> , provided by the PodWorkers extensioncallbackat most once everydurationupon changes. Useful to restrict the firing rate of rapid events (e.g. scroll metrics). -
loading(
) → void - Mark the pod as loading.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notify(
) → void -
Expose explicitly to process batched changes internally.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
obx(
Widget onSuccess(T data), {Widget onError(Object? error)?, Widget onLoading()?, Widget onInitial()?}) → Widget -
A cleaner alternative to handling UI logic explicitly.
Similar to GetX's
.obxmixin! -
once(
void callback(T value)) → VoidCallback -
Available on WhalePod<
CallsT> , provided by the PodWorkers extensioncallbackonly once, the next time the value changes. -
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
setAsError(
Object e) → void - Set the pod to an error state.
-
success(
T newValue) → void - Set success state with the new data.
-
toString(
) → String -
A string representation of this object.
inherited
-
watch(
BuildContext context) → T? -
Registers context to explicitly rebuild when the pod value changes.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited