79198673

Date: 2024-11-18 04:19:45
Score: 0.5
Natty:
Report link

I dont know if I understood your question so sorry if is the case. Do you wish to get the result in string format?

See the code below if it will works for you. While you are typing it will print the value.

      DropdownMenu<Text>(
        enableSearch: true,
        searchCallback: (List<DropdownMenuEntry<Text>> entries, String query) {
          if (query.isEmpty) {
            return null;
          }
          
          print(query);//Here will print what we are typing in the field
          
          final int index = entries.indexWhere((DropdownMenuEntry<Text> entry) => entry.label == query);

          return index != -1 ? index : null;
        },
        dropdownMenuEntries: ['x1','x2','x3','x4','x5'].map<DropdownMenuEntry<Text>>(
              (String txt) {
            return DropdownMenuEntry<Text>(
              value: Text(txt),
              label: txt,
            );
          },
        ).toList(),
      ),
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: Alexandre B.