我想从浏览器打开系统的电子邮件程序,我通过调用来完成此操作
TextSpan(
text: '[email protected]',
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
color: Theme.of(context).primaryColor,
fontWeight: FontWeight.bold,
),
recognizer: TapGestureRecognizer()
..onTap = () async {
await launchUrl(
Uri(
scheme: 'mailto',
path: '[email protected]',
),
);
})
当我在本地测试代码时(也使用 --release 构建),一切正常,但是一旦我将应用程序部署到 firebase 托管,它就会返回一个
Uncaught Error: MissingPluginException(No implementation found for method launch on channel plugins.flutter.io/url_launcher)
我的本地发布版本和我上传到 Firebase 托管的版本有什么区别? 为什么它突然给我这个 MissingPluginException?
我遇到了同样的问题。在我的 pubspec 文件中添加 url_launcher_web 作为依赖项解决了我的问题。
flutter pub add url_launcher_web
发现此评论,它对我的情况有帮助:
使用“flutter clean”清理构建并重建