4

フラッターウェブを学んでいます。
ボタンがクリックされたときに別の URL を開こうとしています。このような方法はありますか:
onclick: ()=>openurl("https://test.com")
どうすればこれを達成できますか?
助けてください

4

4 に答える 4

2

他のプラットフォームと同じように使用できるurl_launcherようになり、Web サポートが追加されました。

https://github.com/flutter/plugins/tree/master/packages/url_launcher/url_launcher_web

于 2019-12-26T00:52:02.657 に答える
2

Flutter Web は (まだ) プラグインをサポートしていないため、次の代替プラグインを使用する必要があります。dart:html

https://api.dartlang.org/stable/2.4.0/dart-html/Window/open.html window.open(url, 'tab');

また

https://api.dartlang.org/stable/2.4.0/dart-html/Window/location.html window.location.assign(url);

于 2019-06-18T20:52:39.890 に答える