checkInputCountries method

dynamic checkInputCountries()

Implementation

checkInputCountries() {
  if (countriesInput.isEmpty) {
    showCountry = Countries.countryList;
  } else {
    for (var i in countriesInput) {
      List<Map<String, dynamic>> countriesFiltered = Countries.countryList
          .where((element) => element["alpha_2_code"] == i.toUpperCase())
          .toList();

      if (countriesFiltered.isNotEmpty) {
        showCountry.add(countriesFiltered[0]);
      } else {
        throw Exception("$i code not found .....");
      }
    }
  }

  update();
}