Skip to main content

Open URL

Most mobile applications provide links that take users to a different section of the same app or to external websites. Open URL helps us in achieving this in our Flutter application.

How to open an URL

Step 1: Select screen

Select the screen from the screen list on which you want to set up open URL.

Step 2: Select a widget, add onClick, choose Navigation, and add function name

Select a widget on which you want to set open URL action, add an onClick property and select Navigation from the listed actions. Also, submit a valid function name for the method name as it will appear in the generated code.

Add onclick and select navigation action to start setting up open url action

Step 3: Select Open Url as navigation type

Select Open Url for Please choose the type of navigation you want to add to add the action.

Now, add the URL which you want to open on the click of widget for Which URL to navigate, please add URL, and lastly, Save changes.

Select Open Url action and add the URL to navigate to in the input

At this stage, you have successfully set open URL action in your application.

Generated code snippet

 onTap() async {
var url = 'https://www.dhiwise.com/';
if (!await launch(url)) {
throw 'Could not launch https://www.dhiwise.com/';
}
}


Got a question? Ask here.