// 注册监听
WidgetsBinding.instance.addObserver(WidgetsBindingObserver);
//监听本地应用生命周期 WidgetsBindingObserver.didChangeAppLifecycleState(AppLifecycleState state)
WidgetsBindingObserver中还包含其他与本地平台状态有关的回调
initState() didChangeDependencies() build() render tree didUpdateWidget() build()
deactivate() dispose()
SchedulerBinding 实现 WidgetsBindingObserver
// 单次Frame绘制回调, 回调后该回调方法会删除 idgetsBinding.instance.addPostFrameCallback
// 实时Frame绘制回调 WidgetsBinding.instance.addPersistentFrameCallback
// 当前页面弹出 WidgetsBindingObserver.didPopRoute
// 有新的页面出来 WidgetsBindingObserver.didPushRoute
// 监听当前页面 换入 换出
RouteObserver
RouteAware
final RouteObserver<PageRoute> routeObserver = RouteObserver<PageRoute>();
MaterialApp.navigatorObservers: [routeObserver]
Page whit RouteAware
routeObserver.subscribe(this, ModalRoute.of(context));
routeObserver.unsubscribe(this);
WidgetsBinding mixin SchedulerBinding mixin WidgetsBindingObserver class
[RouteObserver
[State