How to Use WebView in Flutter

 

How to use WebView in Flutter

Flutter provides many plugins in that you may know about the plugin “Webview”.

On Android,

The Webview widget is backed up by WKWebView

On iOS,

Webview widget is backed up by WebView

Add Package in Main Dart File

At the main dart, enter the basic package

import ‘package:flutter/material.dart’;

Depend Flutter Webview Plugin

  1. Go to “pubspec.yaml” file.
  2. Under “cupertino_icons: ^0.1.2”, enter the code
Flutter_webview_plugin: ^0.2.1+2

Flutter Webview PluginInstall Plugin

  1. To Install the Flutter webview plugin,
  2. Tap “Package get” to install.

Import Package File in Main dart file

import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';

Create Class File in Main Dart

class MyApp extends StatefulWidget {
 @override
 _MyAppState createState() => _MyAppState();
}

Create Webview Scaffold

Widget build(BuildContext context) {
   return WebviewScaffold(
     appBar: AppBar(
       title: TextField(
         ),
       ),
    url: "https://www.webapptiv.com",
   );
 }
}



Webview