Problem:
I'm using DropdownMenu in Flutter with enableSearch: true, and I want to filter the dropdown options based on the user's input in the search field. However, when I type, the keyboard appears, but the text doesn't show up in the dropdown or filter the options.
DropdownMenu<String>(
enableSearch: true,
controller: viewModel.mapControllers["controller"] as TextEditingController,
initialSelection: menuEntries.first.value,
onSelected: (String? value) {
setState(() {
dropdownValue = value!;
(viewModel.mapControllers["controller"] as TextEditingController).text = value;
});
},
dropdownMenuEntries: menuEntries,
)`
What I've tried:
Checking if the TextEditingController is correctly updating.
Using setState() after selection.
Ensuring enableSearch: true, is correctly set.
Expected Behavior:
The dropdown should filter options based on what the user types. The input should be visible in the search field. Actual Behavior:
The keyboard appears, but typed text doesn't show in the dropdown. The dropdown options don't get filtered. How can I make the dropdown dynamically filter the options based on user input?