Skip to content Skip to sidebar Skip to footer

Showing Error While Routing From One Screen To Another In Flutter

I'm moving from one screen to another screen but it shows error in routing. My First screen named as VenueOption and the second one is PlayerOption This is Venue Option Class class

Solution 1:

Try this

class VenueOption extends StatelessWidget {
  final String userType;
  BuildContext ctx;

  const VenueOption({Key key, @required this.userType}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    ctx = context;
    return Scaffold(
      body: ProfileBoard(
        userType: userType,
      ),
    ); 
  }
 void pushToDashboard() {

    Navigator.of(ctx).push(MaterialPageRoute(
              builder: (BuildContext context) => PlayerOption()));
 }
}

Post a Comment for "Showing Error While Routing From One Screen To Another In Flutter"