when<T> abstract method
Pattern matching for async state.
loading
is called if the state is loading.
data
is called if the state contains data.
error
is called if the state contains an error.
Returns the result of the matching callback. All callbacks are required and must be provided.
Implementation
T when<T>({
required T Function() loading,
required T Function(S data) data,
required T Function(ErrorState e) error,
});