error text: Do not use BuildContexts across async gaps.dartuse_build_context_synchronously
I don't understand the reason for the announcement
CodePudding user response:
In stateFulWidget when you use async - await
you have to confirm that next widgets are mounted in Navigation.
So for that you have to add condition for mounted widget
if (!mounted) return;
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ElectionInfo(),
));