fold abstract method

Result<Option<Object>> fold(
  1. @noFutures Option<Object>? onSome(
    1. Some<T> some
    ),
  2. @noFutures Option<Object>? onNone(
    1. None<T> none
    )
)

Folds the two cases of this Option into a single Result.

The onSome and onNone functions must return a new Option.

Implementation

Result<Option<Object>> fold(
  @noFutures Option<Object>? Function(Some<T> some) onSome,
  @noFutures Option<Object>? Function(None<T> none) onNone,
);