I want to access child widget variable value in parent widget whereas child widget is a const widget which does not allow me to use GlobalKey for const child widget.
My question is how can I access child widget without GlobalKey. Here is my code snippet:
class ParentWidget extends StatefulWidget {
@override
State<StatefulWidget> createState() {
// TODO: implement createState
return ParentWidgetState();
}
}
class ParentWidgetState extends State<ParentWidget>
{
@override
Widget build(BuildContext context) {
return Container(
child: const LeftSidePanel(),);
}
}
class LeftSidePanel extends StatefulWidget {
@override
State<StatefulWidget> createState() {
// TODO: implement createState
return LeftPanelWidgetState();
}
const LeftSidePanel(
);
}
class LeftSidePanelState extends State<LeftSidePanel>
{
}
Anyone there to answer my query please. Thanks