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
相关问题
- What means in Dart static type and why it differs
- Flutter : Prepare list data from http request
- How to schedule an alarm on specific time in Flutt
- MappedListIterable is not a SubType
- 'firebase_messaging/FirebaseMessagingPlugin.h&
相关文章
- Observatory server failed to start - Fails to crea
- Flutter error retrieving device properties for ro.
- Adding Shadows at the bottom of a container in flu
- Flutter. Check if a file exists before loading it
- Flutter - http.get fails on macos build target: Co
- Receive share file intents with Flutter
- Do stateless widgets dispose on their own?
- How to clean your build with Flutter RP2 in Androi
Current easiest way to do it is by using
href
with yourhtml
library:Put that code inside your
onTap
method and that's it.Flutter Web does not support plugins (yet), so you have to use replacements from
dart:html
https://api.dartlang.org/stable/2.4.0/dart-html/Window/open.html
window.open(url, 'tab');
or
https://api.dartlang.org/stable/2.4.0/dart-html/Window/location.html
window.location.assign(url);
There is a plugin to achieve this: https://pub.dartlang.org/packages/url_launcher
Import the plugin;
Call the method