forwardGeoCoding method
Forward geocoding of the address
type Address.
City attribute should not be empty.
Postalcode must be greater than 0.
Implementation
Future<Geocoding> forwardGeoCoding(Address address) async {
assert(address.city.isNotEmpty && address.postalCode > 0);
Geocoding? result = _storage.getCachedAddressData(address);
if (result != null) {
return result;
} else {
if (_storage.isLastSentSafe()) {
result = await _service.forwardCoding(address);
_storage.updateLastSent();
_storage.updateCacheData(result);
return result;
}
throw Exception('can not sent more than 1 request per second');
}
}