match<T> method

T match<T>({
  1. required T onSuccess(
    1. Location location
    ),
  2. required T onError(
    1. Error error
    ),
})

Allows you to access the location if it is successful or the error if it is not

Implementation

T match<T>({
  required T Function(Location location) onSuccess,
  required T Function(Error error) onError,
}) =>
    isSuccess ? onSuccess(_location!) : onError(_error!);