clearTasks method

bool clearTasks()

Clears all tasks from the queue.

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

Implementation

@pragma('vm:prefer-inline')
bool clearTasks() {
  assert(isNotExecuting, 'Cannot modify while tasks are executing.');
  if (!isNotExecuting) return false;
  final wasNotEmpty = tasks.isNotEmpty;
  if (wasNotEmpty) tasks.clear();
  return wasNotEmpty;
}