onActive method

  1. @override
void onActive()
override

Called when this screen becomes the topmost visible screen in the router. Fires once after push, and again whenever it becomes topmost after a screen above it pops or hides, or its shell shows it. Always paired with a later onInactive.

Implementation

@override
void onActive() {
  super.onActive();
  orientation = XSensor.orientationListenable.value;
  XSensor.orientationListenable.addListener(_orientationListener);
  _lifecycle = MediaHost.current.lifecycle;
  _lastLifecycle = _lifecycle!.value;
  _lifecycle!.addListener(_lifecycleListener);
}