[英]ERROR:flutter/runtime/dart_vm_initializer.cc(41) Unhandled Exception: type 'String' is not a subtype of type 'int' of 'index' for json file ,flutter
[英]ERROR:flutter/runtime/dart_vm_initializer.cc(41) on url_launcher
在我的 android studio 模拟器上运行调试后,我使用 HTTP 启动器并在我的控制台日志中发现了这个错误:
[错误:flutter/runtime/dart_vm_initializer.cc(41)] 未处理的异常:MissingPluginException(未在通道 plugins.flutter.io/url_launcher_android 上找到方法启动的实现)
这是它抛出错误的代码:
Future<void> _launchMap() async {
final url = widget.website;
var uri = Uri.parse(url);
if (!await launchUrl(uri)) {
throw 'Could not launch';
}
}
这是我的安卓清单:
<queries>
<!-- If your app checks for call support -->
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="tel" />
</intent>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="https" />
</intent>
</queries>
我使用最新的 flutter 版本并且我已经按照https://pub.dev/packages/url_launcher中的指南进行操作,但它仍然无法从我的 API 中定向我想要的链接
如果您使用的是热重启或热重载,则无法解决问题。 由于 Flutter 必须将插件依赖项注入应用程序的特定平台部分,因此热重启/热重载不足以触发注入。 检查此问题以获取更多信息。
关闭应用程序并执行flutter run
命令。
试试下面的代码:
Future<void> _launchMap() async {
final url = widget.website;
var uri = Uri.parse(url);
if (await canLaunchUrl(url)) {
await launchUrl(url);
} else {
throw 'Could not launch $url';
}}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.