i have 3 variable for dropdownValue
to put in a List, how to do it is it possible ?
because i want to make 3 dropdown by looping the list and give every dropdown the value from the list
String dropdownValue1;
String dropdownValue2;
String dropdownValue3;
List dropdownValue = []
CodePudding user response:
Values that we put in the array are should not be null. In your code dropdownValue1
, dropdownValue2
, dropdownValue3
values are null that's when you add them to the array you get an error.
try adding values to variables and them in the array.
Example code:
String dropdownValue1 = "dropdownValue1";
String dropdownValue2 = "dropdownValue2";
String dropdownValue3 = "dropdownValue3";
List<String> dropdownValue = [
dropdownValue1,
dropdownValue2,
dropdownValue3
];
CodePudding user response:
Try this way:
List<String> dropdownValues = ["dropdownValue1","dropdownValue2","dropdownValue3"];
And to use the values:
dropdownValues[index]
//replace the index with the value you want to pick