withTask<T> method

T? withTask<T>(
  1. T cb(
    1. FutureTask task
    )
)

Executes the given cb and returns it's value if there is a running task. If no task is running, returns null.

Implementation

T? withTask<T>(T Function(FutureTask task) cb) {
  final task = _futureTaskManager.task;
  if (task != null) {
    return cb(task);
  }
  return null;
}