executeOr<R, P> method

Future<R> executeOr<R, P>({
  1. required FutureOr<R> doWork(
    1. P argument
    ),
  2. required P argument,
})

执行多线程同步返回微任务 doWork 耗时任务 argument 任务执行传入参数

Implementation

Future<R> executeOr<R, P>({required FutureOr<R> Function(P argument) doWork, required P argument}) async {
  var balancer = await loadBalancer;
  return balancer.run<R, P>(doWork, argument);
}