void scheduleTask(VoidCallback task, Priority priority)

Schedules the given task with the given priority.

Tasks will be executed between frames, in priority order, excluding tasks that are skipped by the current schedulingStrategy. Tasks should be short (as in, up to a millisecond), so as to not cause the regular frame callbacks to get delayed.

Source

void scheduleTask(VoidCallback task, Priority priority) {
  bool isFirstTask = _taskQueue.isEmpty;
  _taskQueue.add(new _TaskEntry(task, priority.value));
  if (isFirstTask)
    _ensureEventLoopCallback();
}