title: How to navigate to a method from another class in flutter
body: <p>I have mainLogin and loginPage classes. From the mainLogin class, I want to navigate to method inside loginPage but I am having an error. Here's my code.</p>
  <p>This one's from the mainLogin</p>
  <pre><code>GestureDetector(
                      onTap: () {
                        Navigator.push(context,
                          MaterialPageRoute(
                            builder: (context) =&gt; loginPage()._showRegistrationForm(context),
                          ),
                        );
                      },
                      child: Text(
                        'SIGN UP',
                        style: TextStyle(color: getColorFromHex('#055ffa')),
  
                      ),
                    ),
  </code></pre>
  <p>and this one's from the loginPage class</p>
  <pre><code>class loginPage extends StatefulWidget {
    @override
    _LoginPage createState() =&gt; _LoginPage();
  }
  
  class _LoginPage extends State&lt;loginPage&gt;{
  
    var fname, lname, uname, email, password, token;
  
    bool _showPassword = false;
  
    _showRegistrationForm(context){
  
          ....// code here
   
  }
  </code></pre>