flatMap<C> method

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

Used to chain multiple functions that return a TaskOption.

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

Implementation

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