StockResponseExtensions<T> extension
Useful StockResponse extensions.
- on
Properties
- isData → bool
-
Available on StockResponse<
Returns if the response is a StockResponseDataT> , provided by the StockResponseExtensions extensionno setter - isError → bool
-
Available on StockResponse<
Returns if the response is a StockResponseErrorT> , provided by the StockResponseExtensions extensionno setter - isLoading → bool
-
Available on StockResponse<
Returns if the response is a StockResponseLoadingT> , provided by the StockResponseExtensions extensionno setter
Methods
-
getDataOrNull(
) → T? -
Available on StockResponse<
If there is data available, returns it; otherwise returns null.T> , provided by the StockResponseExtensions extension -
map<
E> ({required E onLoading(StockResponseLoading< T> value), required E onData(StockResponseData<T> value), required E onError(StockResponseError<T> value)}) → E -
Available on StockResponse<
InvokesT> , provided by the StockResponseExtensions extensiononData
if the response is successful,onLoading
if the response is loading, andonError
if the response is an error. -
mapData<
E> (E onData(StockResponseData< T> value)) → StockResponse<E> -
Available on StockResponse<
InvokesT> , provided by the StockResponseExtensions extensiononData
to transform the StockResponse -
mapOrNull<
E> ({E onLoading(StockResponseLoading< T> value)?, E onData(StockResponseData<T> value)?, E onError(StockResponseError<T> value)?}) → E? -
Available on StockResponse<
InvokesT> , provided by the StockResponseExtensions extensiononData
if the response is successful,onLoading
if the response is loading, andonError
if the response is an error. If the callback is not provided, null is returned. -
maybeMap<
E> ({required E orElse(), E onLoading(StockResponseLoading< T> value)?, E onData(StockResponseData<T> value)?, E onError(StockResponseError<T> value)?}) → E -
Available on StockResponse<
InvokesT> , provided by the StockResponseExtensions extensiononData
ororElse
as fallback if the response is successful,onLoading
ororElse
as fallback if the response is loading, andonError
ororElse
as fallback if the response is an error. -
maybeWhen<
E> ({required E orElse(ResponseOrigin origin), E onLoading(ResponseOrigin origin)?, E onData(ResponseOrigin origin, T data)?, E onError(ResponseOrigin origin, Object error, StackTrace? stackTrace)?}) → E -
Available on StockResponse<
InvokesT> , provided by the StockResponseExtensions extensiononData
ororElse
as fallback if the response is successful,onLoading
ororElse
as fallback if the response is loading, andonError
ororElse
as fallback if the response is an error. -
requireData(
) → T -
Available on StockResponse<
Returns the available data or throws error if there is no data.T> , provided by the StockResponseExtensions extension -
requireError(
) → Object -
Available on StockResponse<
Returns the available data or throws error if there is no data.T> , provided by the StockResponseExtensions extension -
throwIfError(
) → void -
Available on StockResponse<
If this StockResponse is of type StockResponseError, throws the exception. Otherwise, does nothing.T> , provided by the StockResponseExtensions extension -
when<
E> ({required E onLoading(ResponseOrigin origin), required E onData(ResponseOrigin origin, T data), required E onError(ResponseOrigin origin, Object error, StackTrace? stackTrace)}) → E -
Available on StockResponse<
InvokesT> , provided by the StockResponseExtensions extensiononData
if the response is successful,onLoading
if the response is loading, andonError
if the response is an error. -
whenOrNull<
E> ({E onLoading(ResponseOrigin origin)?, E onData(ResponseOrigin origin, T data)?, E onError(ResponseOrigin origin, Object error, StackTrace? stackTrace)?}) → E? -
Available on StockResponse<
InvokesT> , provided by the StockResponseExtensions extensiononData
if the response is successful,onLoading
if the response is loading, andonError
if the response is an error. If the callback is not provided, null is returned.