title: Flutter Navigator.popUntil() with ModalRoute.withName() not working in profile and release mode
body: <p>I have a function that navigates to a new page with route settings</p>
  <pre><code>void pushWithSettings(
      {@required BuildContext context, @required Widget newPage}) {
    Navigator.push(
        context,
        MaterialPageRoute(
            settings: RouteSettings(
              name: newPage.toString(),
            ),
            builder: (_) =&gt; newPage));
  }
  </code></pre>
  <p>and I pop till a particular page using</p>
  <pre><code>Navigator.popUntil(context, ModalRoute.withName(Page().toString));
  </code></pre>
  <p>This works well in debug mode but in profile and release mode it pops only once</p>
  <p>An Example for context</p>
  <pre><code>import 'package:flutter/material.dart';
  import 'package:flutter_app/main.dart';
  
  class FirstPage extends StatelessWidget {
    
    @override
    Widget build(BuildContext context) {
      return Column(
        children: &lt;Widget&gt;[
          Center(child: Text(&quot;First Page&quot;),),
          RaisedButton(
            onPressed: (){
              pushWithSettings(context: context, newPage: SecondPage());
            },
            child: Text(&quot;Navigate to second&quot;, style: TextStyle(inherit: false)),
          )
        ],
      );
    }
  }
  
  class SecondPage extends StatelessWidget {
    
  @override
  Widget build(BuildContext context) {
    return Column(
      children: &lt;Widget&gt;[
        Center(child: Text(&quot;Second Page&quot;),),
        RaisedButton(
          onPressed: (){
            pushWithSettings(context: context, newPage: ThirdPage());
          },
          child: Text(&quot;Navigate to third&quot;, style: TextStyle(inherit: false)),
        )
      ],
    );
  }
  }
  
  class ThirdPage extends StatelessWidget {
    
    @override
    Widget build(BuildContext context) {
      return Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: &lt;Widget&gt;[
          Center(child: Text(&quot;Third Page&quot;),),
          RaisedButton(
            onPressed: (){
              Navigator.popUntil(context, ModalRoute.withName(FirstPage().toString()));
            },
            child: Text(&quot;Navigate to first&quot;, style: TextStyle(inherit: false),),
          )
        ],
      );
    }
  }
  </code></pre>
  <p>In debug mode tapping the button in the third page navigates to the first page but in profile and release mode tapping the button does nothing.
  I'm currently running flutter 1.17.4 on the stable channel</p>