RxFuture<T> class

This class is a subtype of RX, you could use it to observe future state loading, error and result. use .observe() method to trigger the state

Inheritance
  • Object
  • RxInterface<_FutureState<T>>
  • RxNotifier<_FutureState<T>>
  • Rx<_FutureState<T>>
  • RxFuture

Constructors

RxFuture(T lastResult)

Properties

canUpdate bool
no setterinherited
error Object?
Error object threw by the future.
no setter
firstRebuild bool
getter/setter pairinherited
hasError bool
Whether this state has error or not.
no setter
hashCode int
The hash code for this object.
no setterinherited
isStable bool
Whether this state is stable so it is not loading and there is no error.
no setter
lastResult ↔ T
store the previous result of the future.
getter/setter pair
loading bool
Whether state is loading or not.
no setter
result → T
The result of future.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sentToStream bool
getter/setter pairinherited
stream Stream<_FutureState<T>>
no setterinherited
string String
Same as toString() but using a getter.
no setterinherited
subject ↔ GetStream<_FutureState<T>>
getter/setter pairinherited
value ↔ _FutureState<T>
Returns the current value
getter/setter pairinherited

Methods

addError(Object error, [StackTrace? stackTrace]) → void
inherited
addListener(GetStream<_FutureState<T>> rxGetx) → void
This is an internal method. Subscribe to changes on the inner stream.
inherited
bindStream(Stream<_FutureState<T>> stream) → void
Binds an existing Stream<T> to this Rx
inherited
call([_FutureState<T>? v]) → _FutureState<T>
updates the value to null and adds it to the Stream. Even with null-safety coming, is still an important feature to support, as call() doesn't accept null values. For instance, InputDecoration.errorText has to be null to not show the "error state".
inherited
cancel() → void
used to cancel the current future that running, it want throw any exception when no future is running.
close() → void
Closes the subscriptions for this Rx, releasing the resources.
inherited
listen(void onData(_FutureState<T>), {Function? onError, void onDone()?, bool? cancelOnError}) StreamSubscription<_FutureState<T>>
inherited
listenAndPump(void onData(_FutureState<T> event), {Function? onError, void onDone()?, bool? cancelOnError}) StreamSubscription<_FutureState<T>>
Returns a StreamSubscription similar to listen, but with the added benefit that it primes the stream with the current value, rather than waiting for the next value. This should not be called in onInit or anywhere else during the build process.
inherited
map<R>(R mapper(_FutureState<T>? data)) Stream<R>
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
observe(Future<T> callback(T?), {void onSuccess(T)?, void onError(Object)?, void onMultipleCalls()?, void onCancel()?, MultipleCallsBehavior multipleCallsBehavior = MultipleCallsBehavior.abortNew}) Future<void>
the main function for RxFuture which used to trigger the state callback The future to be called that return type is T.
refresh() → void
Makes a direct update of value adding it to the Stream useful when you make use of Rx for custom Types to referesh your UI.
inherited
toJson() → dynamic
Returns the json representation of value.
inherited
toString() String
A string representation of this object.
inherited
trigger(_FutureState<T> v) → void
Following certain practices on Rx data, we might want to react to certain listeners when a value has been provided, even if the value is the same. At the moment, we ignore part of the process if we .call(value) with the same value since it holds the value and there's no real need triggering the entire process for the same value inside, but there are other situations where we might be interested in triggering this.
inherited
update(void fn(_FutureState<T>? val)) → void
Uses a callback to update value internally, similar to refresh, but provides the current value as the argument. Makes sense for custom Rx types (like Models).
inherited

Operators

operator ==(Object o) bool
This equality override works for _RxImpl instances and the internal values.
inherited