title: Flutter local notification onSelectNotification can not open a new page when a local notification is clicked
body: <p>I want my flutter app to open a page when a local notification is clicked. I've defined the following codes in the event listener:</p>
  
  <pre><code>Navigator.push(
     Ccontext,
     MaterialPageRoute(builder: (context) =&gt; PendingOrders()),
   );
  debugPrint('notification payload: ' + payload);
  </code></pre>
  
  <p>The event listener is executed successfully and printed the debugPrint's parameter when a local notification is called but it can not open the PendingOrders route.</p>
  
  <p>Here is the full code in the main.dart</p>
  
  <pre><code>  class _MyAppState extends State&lt;MyApp&gt; {
  final FirebaseMessaging _firebaseMessaging = FirebaseMessaging();
  FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
  @override
  void initState() {
    super.initState();
  
    var android = AndroidInitializationSettings('mipmap/ic_launcher');
    var ios =  IOSInitializationSettings();
    var platform = InitializationSettings(android, ios);
    flutterLocalNotificationsPlugin.initialize(platform,onSelectNotification: onSelectNotification);
  
    _firebaseMessaging.subscribeToTopic('order-created');
    _firebaseMessaging.configure(
      onMessage: (Map&lt;String, dynamic&gt; message) async {
        print("onMessage: $message");
        showNotification(message);
      },
      onLaunch: (Map&lt;String, dynamic&gt; message) async {
        print("onLaunch: $message");
        print("Hafijur");
      },
      onResume: (Map&lt;String, dynamic&gt; message) async {
        print("onResume: ${message['notification']['data']['click_action']}");
      },
    );
    _firebaseMessaging.requestNotificationPermissions(
        const IosNotificationSettings(sound: true, badge: true, alert: true));
  }
  
  showNotification(Map&lt;String, dynamic&gt; msg) async {
    var android = new AndroidNotificationDetails(
      'sdffds dsffds',
      "CHANNLE NAME",
      "channelDescription",
    );
    var iOS = new IOSNotificationDetails();
    var platform = new NotificationDetails(android, iOS);
    await flutterLocalNotificationsPlugin.show(
        0, "New order arrived", "Hey, hurry up! you have a order to deliver", platform,payload: "order created");
  }
   Future onSelectNotification(String payload) async {
    this.build(context);
     Navigator.push(
       context,
       MaterialPageRoute(builder: (context) =&gt; PendingOrders()),
     );
     if (payload != null) {
      debugPrint('notification payload: ' + payload);
    }
  }
  
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: Constants.lightTheme,
      debugShowCheckedModeBanner: false,
      routes: {
        "/": (context) =&gt; MainScreen(),
        "/login": (context) =&gt; LoginPage(),
        "/dashboard": (context) =&gt; Dashboard(),
        "/all_orders": (context) =&gt; AllOrders(),
        "/pending_orders": (context) =&gt; PendingOrders(),
        "/delivered_orders": (context) =&gt; DeliveredOrders(),
        "/order": (context) =&gt; Order(),
      },
    );
  }
  }
  </code></pre>