Q1: how can i get the a certain variable value that is being used in a different screen? i am trying to change the background color of appbar and button by reading a variable that is being used on another screen ?
Explanation: I am fairly new to flutter and experimenting with different things, i have about 5 to six flutter screens and on the 5th screen there is a dropdown list which has 3 values see the code :
Padding(
padding: const EdgeInsets.symmetric(vertical: 10),
child: ListTile(title: Text("select one",style: TextStyle(fontfamily: "Ubuntu",
fontWeight: FontWeight.w200,fontSize: 18,color: Colors.black),),
subtitle: DropdownButton(
isExpanded: true,
items: [
DropdownMenuItem(child: Text("option1"),value: "option1",),
DropdownMenuItem(child: Text("option2"), value: "option2"),
DropdownMenuItem(child: Text("option3"), value: "option3"),
],
i want to get these values and use them on other screens based on the selected option for example : if option 1 is selected then do this if option 2 is selected then do that
Q2: i intend to use simple if statements , once i can get the values from the screen5 , is using if statement the right way to of doing it ?
EDIT 1: i did what Nitesh suggested : this is my code in the 5th screen:
print(Value.getString());
but i am getting the error that error: The method 'getString' isn't defined for the type 'Value'.
