andThen<U> method

Option<U> andThen<U>(
  1. Option<U> fn(
    1. T value
    )
)

If it's Some, apply the function to the value, else return None.

Implementation

Option<U> andThen<U>(Option<U> Function(T value) fn) {
  if (this is Some<T>) {
    return fn((this as Some<T>).value);
  }
  return None<U>();
}