ensureScheduled static method

void ensureScheduled()

Schedules the readiness flip if it hasn't been scheduled yet.

A 500 ms timer is used instead of post-frame callbacks because the engine's platform-view cleanup runs asynchronously and may not complete within one or two vsync intervals. 500 ms is long enough for the engine to finish while remaining imperceptible to the user (the Flutter fallback widgets are shown meanwhile).

Implementation

static void ensureScheduled() {
  if (_ready || _scheduled) return;
  _scheduled = true;

  Future<void>.delayed(const Duration(milliseconds: 500), () {
    if (_ready) return;
    _ready = true;
    readyNotifier.value = true;
  });
}