Home » Android » android – How do I search data in dropDownlist in flutter?-Exceptionshub

android – How do I search data in dropDownlist in flutter?-Exceptionshub

Posted by: admin February 26, 2020 Leave a comment

Questions:

I have a lis of countries that I take this data from an API in dropDownlist,and i want to set a search bar for finding countries easily.I use SearchableDropdown as below code but when I write a name of countries it doesn’t work and doesn’t find anything,how can I solve my problem?

SearchableDropdown(
  isExpanded: true,
  isCaseSensitiveSearch: true,
  hint: Text(
    "Choose...",
    style: TextStyle(
      color: Color(0xffE5E3DD),
      fontFamily: 'nunito',
      fontSize: 2.5 * SizeConfig.textMultiplier,
    ),
  ),
  value: _mySelection1,
  onChanged: (Value1) {
    setState(() {
      _mySelection1 = Value1;
    });
  },
  items:
  countries.entries.map((entry) {
    return DropdownMenuItem(
      value: entry.key,
      child: Text(
        entry.value,
        style: TextStyle(
            color: Colors.black,
            fontFamily: 'nunito',
            fontSize: 2.5* SizeConfig.textMultiplier),
      ),
    );
  }).toList()),
How to&Answers: