Save a reference to the ancestor by calling dependOnInheritedWidgetOfExactType() in the widget's didChangeDependencies() method.
Found this error when navigating the page to another
Basically in the parent scaffold widget should implement key: with global state
First declare the global state
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
Then in the Scaffold widget passing the key to it
Like so
Scaffold(
key: _scaffoldKey,
appBar: AppBar(
title: const Text('Boorkmark'),
),
No comments:
Post a Comment