如何将http网址链接到flutter-web [英] How do I link http url to flutter-web

查看:160
本文介绍了如何将http网址链接到flutter-web的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习Flutter Web。

单击按钮时,我试图打开另一个URL。
是否有这样的方式:

onclick:()=> openurl( https://test.com)

我该如何实现?

请帮助

I'm learning flutter web.
I'm trying to open another url when button is clicked. Is there any way like this:
onclick: ()=>openurl("https://test.com")
How can I achieve this?
Please help

推荐答案

当前最简单的方法为此,可以将 href html 库:

Current easiest way to do it is by using href with your html library:

import 'dart:html' as html;

html.window.location.href = "https://www.google.com" // or any website your want

将代码放入 onTap 方法中,就是这样。

Put that code inside your onTap method and that's it.

这篇关于如何将http网址链接到flutter-web的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆