otherwise method

ClosedAsyncPatternMatcher<I, O> otherwise(
  1. FutureOr<O> function(
    1. I input
    )
)

Implementation

ClosedAsyncPatternMatcher<I, O> otherwise(
    FutureOr<O> Function(I input) function) {
  var newCases = List<_Case<I, dynamic, Future<O>>>.from(_cases);
  newCases.add(_Case(predicate((i) => true, (i) async => i, 'Otherwise'),
      (dynamic i) async {
    return function(await (await i));
  }));
  return ClosedAsyncPatternMatcher(newCases);
}