result method

T result()

Returns a wrapped object of type T, if the result is present.

Check if hasResult before calling this method. If doesn't have the result, will throw a StateError.

Implementation

T result() {
  final res = _result;

  if (res == null) {
    throw StateError(
      'No result has been wrapped. Consider checking the [hasResult] '
      'getter before retrieving the result from the ErrorWrapper.',
    );
  }

  return res;
}