'Is there a way to pull multiple values from a dropdownformfield
I am building a flutter application that has a dropdownformfield. I can get one value from the dropdown but would like to get multiple values.
my Data Model is like below
class Users {
final String uid;
final String firstName;
final String lastName;
final String phone;
Users(
{required this.uid,
required this.firstName,
required this.lastName,
required this.phone});
}
I get data from firestore and convert it into a list for the dropdown like this
final List<String> users = snapshot.data!
.map((user) => '${user.firstName} ${user.lastName}')
.toList();
and set the selected value like so:
onChanged: (val) {
setState(() {
selected = val;
});
}),
This however captures the first and the last name but I would like to get the uid as well.
Anyone know how to do this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
