execute method

  1. @override
void execute(
  1. FutureOr<void> task()
)
override

Runs task, now or later depending on the implementation; a returned Future counts as the rest of the task. Returns at once for an asynchronous executor.

Implementation

@override
void execute(FutureOr<void> Function() task) {
  _active++;
  Timer.run(() async {
    try {
      await task();
    } on Object catch (error, stackTrace) {
      _failed(error, stackTrace);
    } finally {
      if (--_active == 0) {
        _idle?.complete();
        _idle = null;
      }
    }
  });
}