title: Flutter Navigation after receiving Push Notification with FCM
body: <p>The structure of my app is like the following:</p>
  
  <p>RootPage -> Authenticated 
              ? LoadingScreen (after current user is loaded the user is navigated to HomeScreen)
              : SignUpPage</p>
  
  <p>In HomeScreen there is a PageView with 5 children and I want to navigate to page index 3 after opening a push notification. </p>
  
  <p>I call the fcm listener in HomeScreen init</p>
  
  <p>First I tried it without using a delay but that does not work at all.</p>
  
  <pre><code>onResume: (Map&lt;String, dynamic&gt; message) async {
          Navigator.of(context).pushNamedAndRemoveUntil(
                '/home', (Route&lt;dynamic&gt; route) =&gt; false).then((_) =&gt; pageController.jumpToPage(3));
        }
  </code></pre>
  
  <p>Then I used a delay like so with a print statement to test it and it worked!</p>
  
  <pre><code>onResume: (Map&lt;String, dynamic&gt; message) async {
          Navigator.of(context).pushNamedAndRemoveUntil(
                '/home', (Route&lt;dynamic&gt; route) =&gt; false);
          Future.delayed(Duration(milliseconds: 2000))
                .then((_) =&gt; print("Jumped to page index 3"));
        }
  </code></pre>
  
  <p>So I tried it with jumping to page index 3</p>
  
  <pre><code>onResume: (Map&lt;String, dynamic&gt; message) async {
          Navigator.of(context).pushNamedAndRemoveUntil(
                '/home', (Route&lt;dynamic&gt; route) =&gt; false);
          Future.delayed(Duration(milliseconds: 2000))
                .then((_) =&gt; pageController.jumpToPage(3));
        }
  </code></pre>
  
  <p>With this code the navigation to HomeScreen worked but not the jump to index 3 after resuming the app.
  I don't know why. Maybe someone can help me.</p>