flutter-web - 使用 Flutter Web 1.9 打开外部链接
问题描述
我有一个 Flutter Web 项目,从 flutter_web 开始并迁移到 1.9,一切正常,但无法使外部链接工作。
堆栈溢出中有一些解决方案,但任何解决方案似乎都没有按预期工作,从这个链接 和类似的其他链接中尝试了所有解决方案,我认为接受的问题在 1.9 之前可以工作。
解决方案
有了flutter 1.10
,我们可以使用universal_html包打开外部链接:
import 'package:universal_html/prefer_universal/html.dart' as html;
// ...
html.window.location.assign('https://stackoverflow.com');
推荐阅读
- arrays - 在 NASM 中使用 printf 循环
- java - 如何序列化对象列表,这些对象是 avro 生成的实体类型
- node.js - localhost:3000 显示内部服务器错误
- reactjs - 盖茨比:将新主题应用于初学者
- node.js - 尝试发送消息时出现 UnhandledPromiseRejectionWarning
- r - How can I draw 3d hyperplane to illustrate decision boundary using ggplot?
- html - 背景图像未显示在浏览器中
- android - 打包同一个库的多个 APK 会在 AGP 4.0.1 上仅使用一个动态模块导致运行时错误?
- node.js - AWS 通过 api 网关添加实例
- c - C - 递归在二叉搜索树中不起作用