err method

Option<E> err()

The error as Some, or None for an Ok.

final reason = const Err<int, String>('offline').err(); // Some(offline)

Implementation

Option<E> err() {
  return switch (this) {
    Ok<T, E>() => None<E>(),
    Err<T, E>(:final error) => Some<E>(error),
  };
}