Answers for "flutter autocomplete"

1

flutter autocomplete

static const List<String> _kOptions = <String>[
    'aardvark',
    'bobcat',
    'chameleon',
  ];
Autocomplete<String>(
          optionsBuilder: (TextEditingValue textEditingValue) {
          if (textEditingValue.text == '') {
            return const Iterable<String>.empty();
          }
          return _kOptions.where((String option) {
            return option.contains(textEditingValue.text.toLowerCase());
          });
        },
        onSelected: (String selection) {
          print('You just selected $selection');
        },
      )
Posted by: Guest on September-08-2021

Code answers related to "Dart"

Browse Popular Code Answers by Language