I want to fetch the variable of other Stateful Widget
For example, I have three widget such as SmartTag, MySlider, MyHomePage
MyHomePage has SmartTag and MySlider
(this code is not correct just the bulky image)
class _SmartTagState extends State<_SmartTagState>{ var tagState; class _MySliderState extends State<_MySliderState>{ var sliderState; class MyHomePage extends StatefulWidget {} class _MyHomePageState extends State<MyHomePage> { return Row( children:[ MySlider(), SmartTag() floatingActionButton: FloatingActionButton( onPressed: (){ print(MySlider.sliderState)// I want to get the variable fron another widget. print(SmartTag.tagState)// I want to get the variable fron another widget. }, tooltip: 'Increment', child: const Icon(Icons.add), ), ] ) } What I want to do is, getting the other widget varliables when button is pushed.
So,I have some quesitons.
- Is there any way to get the other widgets(
SmartTag,MySlider) variable from_MyHomePageState? _MyHomePageStateshould have the all variables from the beginning? (However when code is long and comples, it's not useful)
Any help appreciated thank you .