convertCountryListToString method

String convertCountryListToString(
  1. String countryCodes
)

Implementation

String convertCountryListToString(String countryCodes) {
  if (countryCodes.isEmpty) return "";

  // Map the list into the required format
  String result = countryCodes.split(",").map((code) => 'country:$code').join('|');

  return result;
}