onSome method

Option<TValue> onSome(
  1. void onSome(
    1. TValue value
    )
)

Calls the provided onSome function if the Option is a Some instance.

Implementation

Option<TValue> onSome(void Function(TValue value) onSome) {
  switch (this) {
    case Some(value: final value):
      onSome(value);
    default:
  }

  return this;
}