getCountryData static method

CountryData? getCountryData(
  1. int id
)

Get country data for the specified country ID.

Parameters

  • IN id The country ID

Returns

  • The country data, null if the specified country ID is invalid

Implementation

static CountryData? getCountryData(final int id) {
  final OperationResult resultString = staticMethod(
    'MapDetails',
    'getCountryData',
    args: id,
  );

  if (resultString['gemApiError'] != 0) {
    return null;
  }

  if (resultString['result']['image'] == -1) {
    return CountryData(
        name: resultString['result']['name'],
        isoCode: resultString['result']['iso']);
  }

  final Img image = Img.init(resultString['result']['image']);

  return CountryData(
      name: resultString['result']['name'],
      isoCode: resultString['result']['iso'],
      flagImage: image);
}