MissingPluginException(使用地理定位器在颤振中找不到实现

Adn*_*der 6 flutter flutter-plugin

我在 flutter 项目中使用地理定位器来获取当前位置,但出现此错误。我在 ios 和 android 文件中添加了所有依赖项仍然收到此错误我不知道为什么 flutter 通道稳定,2.12,

这是我的代码:

Position position = await Geolocato.getCurrentPosition( desiredAccuracy: LocationAccuracy.high);
Run Code Online (Sandbox Code Playgroud)

这是我的错误,我也测试了 android 10、8,但答案相同

Unhandled Exception: MissingPluginException(No implementation found for method getCurrentPosition on channel flutter.baseflow.com/geolocator)
Run Code Online (Sandbox Code Playgroud)

我正在使用地理定位器插件,这里是插件链接:https ://pub.dev/packages/geolocator

小智 4

跑步flutter cleanflutter pub get为我解决了问题。我卸载了该应用程序,清除了设备的缓存并重建了该应用程序。这次出现了一个弹出窗口,要求向应用程序授予位置权限。

我授予了访问权限并获取了设备的当前位置(纬度和经度)。

另请确保通过运行将 flutter 升级到 3.0.0flutter upgrade


归档时间:

查看次数:

10661 次

最近记录:

2 年,11 月 前