Flutter - Navigator.push() giving error "Context does not include a Navigator" on extends State<Main>

  1. Create a global key for the navigator so you can access it from anywhere in the application:
final GlobalKey<NavigatorState> myNavigatorKey = GlobalKey<NavigatorState>();
  1. Assign it to your app when creating MaterialApp:
return MaterialApp(navigatorKey: myNavigatorKey,...);
  1. Use it when pushing routes:
myNavigatorKey.currentState?.pushNamed(...);