title: The return type 'HomePage' isn't a 'Future<void>', as required by the closure's context
body: <p>I'm making pattern shape lock function. I'm stuck in the problem that when the pattern is successes it has to go HomePage() that I made in another file. so I implemented return HomePage() in if block below. but It occurs error that</p>
  <blockquote>
  <p>The return type 'HomePage' isn't a 'Future', as required by the closure's context.</p>
  </blockquote>
  <p>How Can I work arrange this?</p>
  <pre><code>if (pattern != null) ...[
          SizedBox(height: 16),
          MaterialButton(
            color: Colors.green,
            child:
            Text(&quot;Check Pattern&quot;, style: TextStyle(color: Colors.white)),
            onPressed: () async {
              final result = await Navigator.pushNamed(
                context,
                &quot;/check_pattern&quot;,
                arguments: pattern,
              );
              if (result == true) {
                context.replaceSnackbar(
                  content: Text(
                    &quot;it's correct&quot;,
                    style: TextStyle(color: Colors.green),
                  ),
                );
                return HomePage();
              }
            },
  </code></pre>