on method
Utility method to simplify handling the result of a refresh operation
Arguments:
- success: The callback to be called if the refresh was successful, the refreshed data is passed as an argument
- failure: The callback to be called if the refresh failed, the error is passed as an argument
Implementation
on({
Function(T data)? success,
Function(Object error)? failure,
}) {
if (isSuccess && success != null) {
return success(requireData);
}
if (isFailure && failure != null) {
return failure(requireError);
}
}