I wrote a checks for something and then navigates to the next page if the condition is true. However i keep getting an error whenever that condition returns true and i'm meant to navigate
class BuyTickets extends StatefulWidget {
@override
_BuyTicketsState createState() => new _BuyTicketsState();
}
class _BuyTicketsState extends State<BuyTickets> {
@override
void initState(){
...
if(condition){
//Skip to next page
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) => SelectSeat(data: widget.data)
)
);
}
super.initState();
}
@override
Widget build(BuildContext context) {
return new Scaffold(
...
)
}
Error:
please how do i fix?