Search code examples
flutterdartlocationgeocoding

Flutter GeoCode plugin giving : Request Throttled. Over Rate limit: up to 2 per sec. error


I am using flutter GeoCode plugin to fetch address from latitude and longitude.

I inserted a latitude and longitude. It returned address at first(around 2 to 3 times). But after then it is constantly giving me this error.

E/flutter ( 3724): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: [Error]: (006) Request Throttled. Over Rate limit: up to 2 per sec. See geocode.xyz/pricing
E/flutter ( 3724): #0      GeocodeclientImpl.reverseGeocoding.<anonymous closure> (package:geocode/src/service/geocode_client.dart:36:9)
    E/flutter ( 3724): #1      _rootRunUnary (dart:async/zone.dart:1434:47)
    E/flutter ( 3724): #2      _CustomZone.runUnary (dart:async/zone.dart:1335:19)
    E/flutter ( 3724): <asynchronous suspension>

My code is

await Future.delayed(Duration(seconds: 2));
GeoCode geoCode = GeoCode();
Address address = await geoCode.reverseGeocoding(latitude: latitude, longitude: longitude,);
print(address.toString());

I tried awaiting for few seconds before calling the method by using Future.delayed() but of no use. So please tell me how to solve these problem or if there's any other better plugin to solve the requirement. Also is there any limit on number of requests for geocoding or some other conditions.


Solution

  • Just use geocoding library.

    It uses free geocoding functions of your device. No need of 3rd party geodata providers.