On<T> class

Callbacks to be invoked depending on the state status of an Injected model

For more control on when to invoke the callbacks use:

  • On.data: The callback is invoked only when the Injected model emits a notification with onData status.
  • On.waiting: The callback is invoked only when the Injected model emits a notification with waiting status.
  • On.error: The callback is invoked only when the Injected model emits a notification with error status.

See also: On.all, On.or.

Available Extensions

Constructors

On(T builder())
The callback is always invoked when the Injected model emits a notification.
factory
On.all({T onIdle()?, required T onWaiting(), required T onError(dynamic err, void refresh()), required T onData()})
Set of callbacks to be invoked when the Injected model emits a notification with the corresponding state status.
factory
On.data(T fn())
The callback is invoked only when the Injected model emits a notification with onData status.
factory
On.error(T fn(dynamic err, void refresh()))
The callback is invoked only when the Injected model emits a notification with error status.
factory
On.or({T onIdle()?, T onWaiting()?, T onError(dynamic err, void refresh())?, T onData()?, required T or()})
Set of callbacks to be invoked when the Injected model emits a notification with the corresponding state status.
factory
On.waiting(T fn())
The callback is invoked only when the Injected model emits a notification with waiting status.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

call(SnapState snapState, [bool isSideEffect = true]) → T?
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

Static Methods

animation<F>(Widget anim(Animate animate)) → OnAnimation
Used to subscribe to an InjectedAnimation.
auth<T>({T onInitialWaiting()?, T onWaiting()?, required T onUnsigned(), required T onSigned()}) → OnAuth<T>
crud<T>({required T onWaiting()?, required T onError(dynamic err, void refresher())?, required T onResult(dynamic data)}) OnCRUD<T>
form(Widget builder()) → OnForm
formSubmission({required Widget onSubmitting(), Widget onSubmissionError(dynamic error, VoidCallback onRefresh)?, required Widget child}) → OnFormSubmission
future<F>({required Widget onWaiting()?, required Widget onError(dynamic err, void refresh())?, required Widget onData(F data, void refresh())}) OnFuture<F>
scroll<T>(T builder(InjectedScrolling scroll)) → OnScroll<T>
Listen to InjectedScrolling