navigatorKey property

GlobalKey<NavigatorState> get navigatorKey

a GlobalKey

import 'package:flutter_meedu/router.dart';
class MyApp extends StatelessWidget {
 @override
 Widget build(BuildContext context) {
   return MaterialApp(
     navigatorKey: router.navigatorKey, // add the navigator key
     home: HomePage(),
     routes: {YOUR_ROUTES},
   );
 }
}

Implementation

GlobalKey<NavigatorState> get navigatorKey {
  _navigatorKey ??= GlobalKey<NavigatorState>();
  return _navigatorKey!;
}