How do I open an external url in flutter web in new tab or in same tab

后端 未结 5 1019
梦如初夏
梦如初夏 2021-02-18 23:16

I have a simple web app I have created with flutter web. I would like to know how I can open new an external url either in a new tab or in the sa

5条回答
  •  天命终不由人
    2021-02-18 23:30

    Answered here https://stackoverflow.com/a/56656885/361832

    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);

提交回复
热议问题