get method

MunicipalityModel get (
  1. String municipalityQuery,
  2. {bool suggestion: false}

Method that given a municipality of the user searches the cuban municipalities to find the best match and returns the municipality. The best match is considered as the cuban municipality of shorter length that contains the given municipality.


MunicipalityModel get(String municipalityQuery, {bool suggestion = false}) {
  var municipality = _repository.getMunicipality(municipalityQuery);
  if (suggestion && municipality == null) {
    municipality = _repository.getSuggestion(municipalityQuery);
  return municipality;