clearTasks method

bool clearTasks()

Clears all tasks from the queue.

Returns true if the queue was not empty before clearing, false otherwise.

Implementation

bool clearTasks() {
  return _ifNotExecuting(() {
        final wasNotEmpty = tasks.isNotEmpty;
        if (wasNotEmpty) {
          tasks.clear();
        }
        return wasNotEmpty;
      }) ??
      false;
}