readInitialLifecycleStateFromNativeWindow method

  1. @protected
void readInitialLifecycleStateFromNativeWindow()

Initializes the lifecycleState with the dart:ui.PlatformDispatcher.initialLifecycleState.

Once the lifecycleState is populated through any means (including this method), this method will do nothing. This is because the dart:ui.PlatformDispatcher.initialLifecycleState may already be stale and it no longer makes sense to use the initial state at dart vm startup as the current state anymore.

The latest state should be obtained by subscribing to WidgetsBindingObserver.didChangeAppLifecycleState.


void readInitialLifecycleStateFromNativeWindow() {
  if (lifecycleState != null || platformDispatcher.initialLifecycleState.isEmpty) {