Dynamic dropdown โ€“ filter out duplicate options

Database & APIs

I have a collection stored in Firebase. Each document in the collection has a field called "Category", "Subcategory" and "Item"

I want users to select a "Category" using DropDown1, then "Subcategory" using DropDown2, then "Item" using DropDown3.

The problem I am having is filtering out the duplicates in DropDown1, and in DropDown2.

I can successfully populate the dropdown options with a backend query, but I cannot figure out how to filter out the duplicate options.

What have you tried so far?

I have tried using a custom function, which unfortunately did not work.

I did the following (screen shot attached):

Define Options > Map List Items > Item in list > Get Document Property > "Category"

Filter List Items > Custom Functions > newCustomFunction()

I used Copilot to write this custom function (screenshot attached):

List<String> backendList = [

];

List<String> uniqueList = backendList.toSet().toList();

return uniqueList.toString();

I am not a coder so I am not sure why this does not work. Therefore, any help would be very much appreciated.

PLEASE NOTE: There are several YouTube tutorials on dynamic drop-downs, however, these are for cases that only require two dropdowns, not three. Both use "Car Make" and "Car Model" as an example and accomplish the desired result by adding a second collection (Car Make) to do the filtering.

Did you check FlutterFlow's Documentation for this topic?
Yes
1
1 reply