'How to Store Selected Values in ListViewBuilder and passing to next screen
Is There any Option to Store Selected Values in List View and passsing to the Next Screen like the Selected Value is Stored in Variable we pass that variable to next screen
Solution 1:[1]
You should have a List in which you will save selected values, something like this:
List<Object> values=[];
later, when you select any item:
onTap: () {
values.add("item #X");
}
and when you want to show next screen, you should pass your list as an argument.
Navigator.pushNamed(
context,
NewRoute,
arguments: values,
);
or maybe you would want to create a class to handle better your arguments, something like this https://docs.flutter.dev/cookbook/navigation/navigate-with-arguments
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Carlos Sandoval |
