A Brief But Accurate Documentation, BSD Linux And Programming

 Docker

Saturday, January 15, 2022

save a reference to the ancestor by calling dependOnInheritedWidgetOfExactType()




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

Back to top