Sometimes, we may want to open a specific web page inside our mobile app so that users don’t feel they are opening a website. In such situations, a webview inside the app will be extremely useful. In this flutter tutorial, I will show you how to open a URL using WebView in flutter.
First of all, flutter doesn’t have a dedicated inbuilt webview widget. Fortunately, there’s a plugin named webview flutter which is developed by the official flutter development team.
As webview flutter is a plugin you need to add it’s dependency in pubspec.yaml file.
dependencies: flutter: sdk: flutter webview_flutter: 1.0.1
Now, you can easily create a webview in flutter as given below.
WebView( initialUrl: 'https://flutterforyou.com', );
In Android platform you have to set WebView.platform = SurfaceAndroidWebView(); . Also note that SurfaceAndroidWebView requires minimum of API level 19.
Go through the following flutter webview example to get the full idea.
Following is the output of this flutter tutorial.
I hope this flutter tutorial will be helpful for you.