ResultListenable<T> class abstract mixin

Abstract class/mixin for ValueListenable subclasses that holds a Result.

The primary implementation of this class is ResultNotifier, however this interface allows other implementations to be used throughout the library.

Implemented types
Implementers
Available Extensions

Constructors

ResultListenable()

Properties

hasData bool
Checks if the result contains data, regardless of the result type. Note that this is different from isData.
no setter
hashCode int
The hash code for this object.
no setterinherited
isCancelled bool
Checks if the current state is Error and the error is a CancelledException.
no setter
isData bool
Checks if the result is Data. Note that this is different from if this notifier currently contains data (i.e. hasData).
no setter
isError bool
Checks if the current state is Error.
no setter
isInitial bool
Checks if the the result is the Initial loading state.
no setter
isLoading bool
Checks if the the result is Loading. Note that the initial state (Initial) is also interpreted as a loading state.
no setter
isLoadingData bool
Checks if the data is currently being loaded, i.e. the current state is Loading but not Initial.
no setter
isReloading bool
Checks if data is currently being reloaded, i.e. the current state is Loading and hasData.
no setter
lastUpdate DateTime
The last time the result was updated.
no setter
result Result<T>
Just an alias for value.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value Result<T>
The current value of the object. When the value changes, the callbacks registered with addListener will be invoked.
no setterinherited

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object notifies its listeners.
inherited
alwaysData(T defaultData) ResultNotifier<T>
Creates a new ResultNotifier that only gets updated when the data of this notifier changes, i.e. ignoring Loading and Error states.
asyncEffect<R>(AsyncEffect<T, R> effect, {R? data, Result<R>? result, Duration? expiration, ResultNotifierCallback<R>? onReset, R onErrorReturn(Object? error)?, bool autoReset = false, bool refreshOnError = false, bool ignoreLoading = false}) EffectNotifier<T, R>
Creates a new asynchronous EffectNotifier that executes the provided asynchronous effect the data of this notifier changes.
builder(Widget builder(BuildContext context, Result<T> result, Widget? child), {Widget? child}) ValueListenableBuilder<Result<T>>
Convenience method for simplifying the creation of a ValueListenableBuilder with ResultNotifier.
combineLatest<R>(ResultListenable<T> other, {required R combineData(List<T> data)}) CombineLatestNotifier<T, R>
Creates a new CombineLatestNotifier that that combines the value of this notifier with another one.
effect<R>(Effect<T, R> effect, {R? data, Result<R>? result, Duration? expiration, ResultNotifierCallback<R>? onReset, R onErrorReturn(Object? error)?, bool autoReset = false, bool refreshOnError = false, bool ignoreLoading = false}) EffectNotifier<T, R>
Creates a new synchronous EffectNotifier that executes the provided effect the data of this notifier changes.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onData(void listener(T data)) VoidCallback
Registers a listener (addListener) that will only be invoked for Data results.
onError(void listener(Object? error, StackTrace? stackTrace, T? data)) VoidCallback
Registers a listener (addListener) that will only be invoked for Error results.
onLoading(void listener(T? data)) VoidCallback
Registers a listener (addListener) that will only be invoked for Loading results.
onResult(void listener(Result<T> result)) VoidCallback
Registers a listener (addListener) that will be invoked with the current Result (value).
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that the object notifies.
inherited
streamEffect<R>(StreamEffect<T, R> effect, {R? data, Result<R>? result, Duration? expiration, ResultNotifierCallback<R>? onReset, R onErrorReturn(Object? error)?, bool autoReset = false, bool refreshOnError = false, bool ignoreLoading = false}) EffectNotifier<T, R>
Creates a new asynchronous EffectNotifier that executes the provided strean effect the data of this notifier changes.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited