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
The return type 'HomePage' isn't a 'Future', as required by the closure's context.
How Can I work arrange this?
if (pattern != null) ...[
SizedBox(height: 16),
MaterialButton(
color: Colors.green,
child:
Text("Check Pattern", style: TextStyle(color: Colors.white)),
onPressed: () async {
final result = await Navigator.pushNamed(
context,
"/check_pattern",
arguments: pattern,
);
if (result == true) {
context.replaceSnackbar(
content: Text(
"it's correct",
style: TextStyle(color: Colors.green),
),
);
return HomePage();
}
},