Flutter GeoCode 插件给出:请求受到限制。超过速率限制:每秒最多 2 次。错误

发布于 2025-01-16 15:49:32 字数 1060 浏览 5 评论 0原文

我正在使用 flutter GeoCode 插件从纬度和经度获取地址。

我插入了纬度和经度。它首先返回地址(大约 2 到 3 次)。但此后它不断给我这个错误。

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>

我的代码是

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

我尝试在使用 Future.delayed() 调用该方法之前等待几秒钟,但没有用。所以请告诉我如何解决这些问题或者是否有其他更好的插件来解决需求。此外,地理编码请求数量或其他条件是否有限制。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

时光倒影 2025-01-23 15:49:32

只需使用 地理编码 库即可。

它使用您设备的免费地理编码功能。不需要第三方地理数据提供商。

Just use geocoding library.

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文