getx_router_observer.dart 500 B

12345678910111213141516
  1. import 'package:flutter/cupertino.dart';
  2. import 'package:get/get_navigation/src/router_report.dart';
  3. /// 手动让getx感知原生路由 (固定代码无需修改)
  4. class GetXRouterObserver extends NavigatorObserver {
  5. @override
  6. void didPush(Route<dynamic> route, Route<dynamic>? previousRoute) {
  7. RouterReportManager.reportCurrentRoute(route);
  8. }
  9. @override
  10. void didPop(Route<dynamic> route, Route<dynamic>? previousRoute) async {
  11. RouterReportManager.reportRouteDispose(route);
  12. }
  13. }