building property

bool get building

Provides an estimate regarding whether a build is imminent.

This allows classes such as ProxyNotifier to decide whether to fire immediately or use Future.microtask to mitigate duplicate notifications.

Implementation

bool get building => switch (schedulerPhase) {
  SchedulerPhase.midFrameMicrotasks || SchedulerPhase.persistentCallbacks => true,
  SchedulerPhase.postFrameCallbacks ||
  SchedulerPhase.transientCallbacks ||
  SchedulerPhase.idle =>
    false,
};