title: Flutter Navigator pushAndRemove Help (Not named routes)
body: <p>I don't use named routes in the app. Instead followed by the inspiration from FlutterBloc library I use route definitions like this.</p>
  <pre><code>class OrganizationPage extends StatelessWidget {
    static Route route() {
      return MaterialPageRoute&lt;void&gt;(builder: (_) =&gt; OrganizationPage());
    }
  
    // ....
  }
  </code></pre>
  <p>And I navigate using...</p>
  <pre><code>Navigator.push(
    context,
    LoginPage.route(),
  );
  </code></pre>
  <p>Assume from the point of loading the <code>OrganizationPage</code> I have navigated few times. I want a button press that will pop OrganizationPage route + every thing else on top of it and load a new page. How can this be done?</p>
  <p>I thought of doing some thing like this...</p>
  <pre><code>Navigator.pushAndRemoveUntil(
    context,
    HomePage.route(),
    (Route&lt;dynamic&gt; route) {
      // print(&quot;Checking route: $route&quot;);
      // return route.builder.toString().contains(&quot;OrganizationPage&quot;)
      // `builder` is not available, even though it did in the debugger.
    },
  );
  </code></pre>
  <p>Can what I want be done? If so how?</p>
  <p>I assume if I use named routes it might be easier? Unfortunately I have written a lot of code and prefer to avoid a refactor. Also this way I can accept any args to a page easily.</p>
  <p>Thanks in advance.</p>