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 VenueOption extends StatelessWidget {
final String userType;
const VenueOption({Key key, @required this.userType}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: ProfileBoard(
userType: userType,
),
);
/*return MaterialApp(
debugShowCheckedModeBanner: false,
home:Scaffold(
body: ProfileBoard(
userType: userType,
),)
);*/
}
}
There is a button inside ProfileBoard
, this class is statefull class and navigation screen to 'PlayerOption' by this method
void pushToDashboard(BuildContext context) {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => PlayerOption()),
);
// Navigator.push(context, MaterialPageRoute(builder: (context) => VenuProfile(userType: userType,)),);
}
PlayerOption
class
class PlayerOption extends StatefulWidget {
@override
_PlayerOptionState createState() => _PlayerOptionState();
}
class _PlayerOptionState extends State<PlayerOption> {
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset:false,
body: PlayerOptionHome(),
);
/* return MaterialApp(
debugShowCheckedModeBanner: false,
home:Scaffold(
resizeToAvoidBottomInset:false,
body: PlayerOptionHome(),
)
);*/
}
}
> The following NoSuchMethodError was thrown building > _OverlayEntry-[LabeledGlobalKey<_OverlayEntryState>#be2a0](dirty, state: _OverlayEntryState#6e209): The getter 'status' was called on > null. Receiver: null Tried calling: status When the exception was > thrown, this was the stack: > #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:50:5) > #1 ModalRoute._buildModalBarrier (package:flutter/src/widgets/routes.dart:1239:27) > #2 _OverlayEntryState.build (package:flutter/src/widgets/overlay.dart:170:25) > #3 StatefulElement.build (package:flutter/src/widgets/framework.dart:3825:27) > #4 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3739:15) > #5 Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5) > #6 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5) > #7 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3864:11)
Another exception was thrown: NoSuchMethodError: The getter 'status' was called on null.
I made PlayerOption
with MaterialApp
now the screen is navigating from 'VenueOptionto
PlayerOptionbut when I tried to call another screen from
PlayerOptionto
PlayerConnect ` showing error
> Another exception was thrown: > 'package:flutter/src/widgets/navigator.dart': Failed assertion: line > 1562 pos 12: '!_debugLocked': is not true.
class PlayerConnect extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: FeedView(),
);
}
}
Try this