I am running into a globalKey error after I navigate from Screen A to Screen B and click a \"Cancel\" button to go back to Scree
globalKey
Screen A
Screen B
Scree
Best way to solve that, which worked for me:
class _HomeScreenState extends State { GlobalKey _homeKey = GlobalKey(debugLabel: '_homeScreenkey'); @override Widget build(BuildContext context) { return Container( key: _homeKey, ); } }