convert static method

KdlCountry2? convert(
  1. KdlValue value, [
  2. String type = 'country2'
])

Convert a KdlString into KdlCountry2

Implementation

static KdlCountry2? convert(KdlValue value, [String type = 'country2']) {
  if (value is! KdlString) return null;

  var country = Country.countries2[value.value];
  if (country == null) throw "invalid country2: ${value.value}";

  return KdlCountry2(country, type);
}