Reputation: 105
im newbie with flutter and i'm trying to fill this FindDropdown that i found with the data i get from api.
FindDropdown(
searchBoxDecoration: InputDecoration(
hintText: "Buscar",
border: OutlineInputBorder(
borderSide:
new BorderSide(color: Constants.blackAudi),
)),
label: "Seleccione el Taller:",
labelVisible: true,
items: [_.talleres[0].nombre],
onChanged: (item) {
print(item);
countriesKey.currentState
?.setSelectedItem(<String>[]);
},
showSearchBox: true,
showClearButton: true,
titleStyle: TextStyle(color: Constants.blackAudi),
),
As you can see in the items: part im using the call to my method, however i am only calling the first item and i need to get all of them.
EDIT: tried using _.talleres.map((e) => e.nombre).toList()
but didnt worked either :(
i got this:
I appreciate any help you can give :)
Upvotes: 0
Views: 199
Reputation: 914
Edit-1:
FindDropdown takes a builder if your list is not predefined you can use that builder to build up your list. you can find an example here
You can try the map
function to get all the values and then convert it into a list, as shown below.
items: _.talleres.map( (e) => e.nombre ).toList()
Upvotes: 2