flatMap<C> method

  1. @override
IOOption<C> flatMap<C>(
  1. covariant IOOption<C> f(
    1. R r
    )
)
override

Used to chain multiple functions that return a IOOption.

You can extract the value of every Some in the chain without handling all possible missing cases. If running any of the functions in the chain returns None, the result is None.

Implementation

@override
IOOption<C> flatMap<C>(covariant IOOption<C> Function(R r) f) =>
    IOOption(() => run().match(
          Option.none,
          (r) => f(r).run(),
        ));