I've created a web app with flutter and I want to open the second screen in a new tab. Is there any way to do that?
-
Please research before asking. Here is one existing answer => https://stackoverflow.com/questions/56220691/how-do-i-open-an-external-url-in-flutter-web-in-new-tab-or-in-same-tab – daddygames Sep 01 '21 at 14:25
-
1@daddygames I'm not trying to open an external link. I want to open a page in my own app in a new tab. – Mahesh Mohotti Sep 01 '21 at 14:30
2 Answers
import 'package:universal_html/html.dart' as html;
static openNewTab({String setUrl, String setTitle}) {
return html.window.open(
setUrl,
setTitle,
);
}

- 1,287
- 1
- 9
- 20
-
4Code is a lot more helpful when it is accompanied by an explanation. Stack Overflow is about learning, not providing snippets to blindly copy and paste. Please [edit] your answer and explain how it answers the specific question being asked. See [answer]. – ChrisGPT was on strike Aug 18 '22 at 19:58
-
universal_html is lib used in flutter web. Code is very easy as window.open() is for opening new tab which receives url and title. Url is of your page or can be any. – Muhammad Umair Saqib Aug 19 '22 at 04:34
-
In your current tab view, build the URL for the new page, then launch it using one of these methods:
How do I open an external url in flutter web in new tab or in same tab
Then, configure your app for for reading query parameters. You can then use those parameters to determine the starting view for your app in the new browser tab.
Here is a discussion about ways to handle query parameters:
How can a named route have URL parameters in flutter web?
Alternatively, uni_links is a package that I have used for deep linking. You can also use this as a way to control what view your user sees at a specific link. The package allows your app to listen for URLs, then you can inspect the parts of the URL and take an action based on parameters, such as navigating to a specific view.

- 1,880
- 1
- 11
- 18