map abstract method

void map({
  1. required void onSuccess(
    1. T value
    ),
  2. required void onFailure(
    1. ErrorMessage errorMessage
    ),
})

Calls the appropriate callback based on the result being a success or a failure.

onSuccess is the function to be called with the value if the result is a success. onFailure is the function to be called with the error message if the result is a failure.

Implementation

void map({
  required void Function(T value) onSuccess,
  required void Function(ErrorMessage errorMessage) onFailure,
});