onLoading method
Registers a listener (addListener) that will only be invoked for Loading results.
Use the returned VoidCallback function to unsubscribe the listener (i.e. calls removeListener).
See also:
- onResult for a more general listener.
Implementation
@useResult
VoidCallback onLoading(void Function(T? data) listener) => onResult((result) {
if (result case final Loading<T> loading) listener(loading.data);
});