Benn
Benn

Reputation: 35

Is possible open a web page in a flutter app?

in my application I need to open a webpage (ex. https://www.google.com/) in the application. With url_launcher opens the default browser eg safari or chrome. Instead, I would like to view the web page inside, without opening an external browser Can anyone help me?

Upvotes: 0

Views: 3141

Answers (2)

matr0s
matr0s

Reputation: 107

Hi you can use the Webview package, I guess

Example:

import 'package:webview_flutter/webview_flutter.dart';

return Scaffold(
      appBar: AppBar(
        title: const Text('Flutter WebView example'),
      ),
      body: const WebView(
        initialUrl: 'https://flutter.io',
        javascriptMode: JavascriptMode.unrestricted,
      ),
    );

Source: https://pub.dev/packages/webview_flutter

Upvotes: 3

Sarvesh Dalvi
Sarvesh Dalvi

Reputation: 2678

You can force your url_launcher plugin to open the page on web view by adding the optional parameter :

launch('website_name',forceWebView: true);

Upvotes: 0

Related Questions