yakforward-ou/yak_packages

[yak_runner] runBypassAsync should take a FutureOr returning function

Closed this issue · 0 comments

extension RunBypassAsyncX<S extends Object> on FutureResult<S> {
  FutureResult<S> runBypassAsync(
--    UnaryAsync<void, S> function,
  ) async {
    final result = await this;
    if (result.isSuccess) {
      final bypass = await function.runVoidAsync(result.asSuccess);
      if (bypass.isFailure) {
        return bypass.asFailure.recast();
      }
    }
    return result;
  }
}