alt method

  1. @override
TaskOption<R> alt(
  1. covariant TaskOption<R> orElse()
)
override

When this TaskOption returns Some, then return the current TaskOption. Otherwise return the result of orElse.

Used to provide an alternative TaskOption in case the current one returns None.

Implementation

@override
TaskOption<R> alt(covariant TaskOption<R> Function() orElse) =>
    TaskOption(() async => (await run()).match(
          () => orElse().run(),
          some,
        ));