unwrap property

T get unwrap

Get the wrapped value or throw error if this Maybe represents an error.

Implementation

T get unwrap {
  switch (this) {
    case MaybeValue<T>(:final value):
      return value;

    case MaybeError<T>(:final error, :final stackTrace):
      if (stackTrace != null) {
        Error.throwWithStackTrace(error, stackTrace);
      }

      throw error;
  }
}