为什么在URL启动器中扑出我的URL null?
ElevatedButton(
onPressed: () async {
const url ='https://www.facebook.com';
if (await canLaunch(url)) {
await launch(url,forceWebView: true,enableJavaScript: true);
} else {
// can't launch url
}
},
);
I/UrlLauncher( 7566): component name for https://www.facebook.com is null
ElevatedButton(
onPressed: () async {
const url ='https://www.facebook.com';
if (await canLaunch(url)) {
await launch(url,forceWebView: true,enableJavaScript: true);
} else {
// can't launch url
}
},
);
I/UrlLauncher( 7566): component name for https://www.facebook.com is null
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
添加每个平台的查询,请按照此链接中的文档 url启动器API参考
ios
将传递给CanlaunchUrl的所有URL方案添加为您的Info.plist文件中的lsapplicationqueriesschemes条目。
Android
从API 30开始,Android需要您的AndroidManifest.xml中的包装可见性配置,否则CanlaunchUrl将返回false。作为根元素的孩子,必须将元素添加到您的清单中。
这对我有用!
Add the queries for each platform, follow the documentation in this link URL Launcher API Reference
iOS
Add any URL schemes passed to canLaunchUrl as LSApplicationQueriesSchemes entries in your Info.plist file.
Android
Starting from API 30 Android requires package visibility configuration in your AndroidManifest.xml otherwise canLaunchUrl will return false. A element must be added to your manifest as a child of the root element.
This works for me!