framework/observers/app_route_observers library
Classes
- AppRouteObserver
-
class ObserverPage extend State<> with RouteAware { @override void didChangeDependencies() { super.didChangeDependencies(); // 注册监听 AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)); } void dispose() { // 注销监听 AppRouteObserver().routeObserver.unsubscribe(this); super.dispose(); } @override void didPop() { } } ### main.dart navigatorObservers: [ AppRouteObserver().routeObserver, ],