{"id":13724762,"url":"https://github.com/fluttercommunity/flutter_webview_plugin","last_synced_at":"2026-01-11T13:32:26.615Z","repository":{"id":39817652,"uuid":"89395008","full_name":"fluttercommunity/flutter_webview_plugin","owner":"fluttercommunity","description":"Community WebView Plugin - Allows Flutter to communicate with a native WebView. ","archived":false,"fork":false,"pushed_at":"2024-03-19T07:40:21.000Z","size":7510,"stargazers_count":1487,"open_issues_count":553,"forks_count":939,"subscribers_count":43,"default_branch":"master","last_synced_at":"2025-04-14T04:59:22.977Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/flutter_webview_plugin","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fluttercommunity.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-25T18:44:47.000Z","updated_at":"2025-02-24T04:56:03.000Z","dependencies_parsed_at":"2024-06-18T11:13:19.223Z","dependency_job_id":null,"html_url":"https://github.com/fluttercommunity/flutter_webview_plugin","commit_stats":{"total_commits":231,"total_committers":68,"mean_commits":"3.3970588235294117","dds":0.8398268398268398,"last_synced_commit":"6ab3a30353caf69eb7bd9cfc4bbe8d1e51b04e31"},"previous_names":["dart-flitter/flutter_webview_plugin"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercommunity%2Fflutter_webview_plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercommunity%2Fflutter_webview_plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercommunity%2Fflutter_webview_plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercommunity%2Fflutter_webview_plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fluttercommunity","download_url":"https://codeload.github.com/fluttercommunity/flutter_webview_plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254270641,"owners_count":22042858,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest"],"created_at":"2024-08-03T01:02:03.087Z","updated_at":"2026-01-11T13:32:26.607Z","avatar_url":"https://github.com/fluttercommunity.png","language":"Java","funding_links":[],"categories":["Flutter","Java"],"sub_categories":["Components"],"readme":"[![Flutter Community: flutter_webview_plugin](https://fluttercommunity.dev/_github/header/flutter_webview_plugin)](https://github.com/fluttercommunity/community)\n\n# NOTICE\n\u003e We are working closely with the Flutter Team to integrate all the Community Plugin features in the [Official WebView Plugin](https://pub.dev/packages/webview_flutter). We will try our best to resolve PRs and Bugfixes, but our priority right now is to merge our two code-bases. Once the merge is complete we will deprecate the Community Plugin in favor of the Official one. \n\u003e \n\u003e Thank you for all your support, hopefully you'll also show it for Official Plugin too.\n\u003e \n\u003e Keep Fluttering!\n\n# Flutter WebView Plugin\n\n[![pub package](https://img.shields.io/pub/v/flutter_webview_plugin.svg)](https://pub.dartlang.org/packages/flutter_webview_plugin)\n\nPlugin that allows Flutter to communicate with a native WebView.\n\n**_Warning:_**\nThe webview is not integrated in the widget tree, it is a native view on top of the flutter view.\nYou won't be able see snackbars, dialogs, or other flutter widgets that would overlap with the region of the screen taken up by the webview.\n\nThe getSafeAcceptedType() function is available only for minimum SDK of 21.\neval() function only supports SDK of 19 or greater for evaluating Javascript.\n\n## Getting Started\n\nFor help getting started with Flutter, view our online [documentation](http://flutter.io/).\n\n#### iOS\n\nIn order for plugin to work correctly, you need to add new key to `ios/Runner/Info.plist`\n\n```xml\n\u003ckey\u003eNSAppTransportSecurity\u003c/key\u003e\n\u003cdict\u003e\n    \u003ckey\u003eNSAllowsArbitraryLoads\u003c/key\u003e\n    \u003ctrue/\u003e\n    \u003ckey\u003eNSAllowsArbitraryLoadsInWebContent\u003c/key\u003e\n    \u003ctrue/\u003e\n\u003c/dict\u003e\n```\n\n`NSAllowsArbitraryLoadsInWebContent` is for iOS 10+ and `NSAllowsArbitraryLoads` for iOS 9.\n\n\n### How it works\n\n#### Launch WebView Fullscreen with Flutter navigation\n\n```dart\nnew MaterialApp(\n      routes: {\n        \"/\": (_) =\u003e new WebviewScaffold(\n          url: \"https://www.google.com\",\n          appBar: new AppBar(\n            title: new Text(\"Widget webview\"),\n          ),\n        ),\n      },\n    );\n```\n\nOptional parameters `hidden` and `initialChild` are available so that you can show something else while waiting for the page to load.\nIf you set `hidden` to true it will show a default CircularProgressIndicator. If you additionally specify a Widget for initialChild\nyou can have it display whatever you like till page-load.\n\ne.g. The following will show a read screen with the text 'waiting.....'.\n```dart\nreturn new MaterialApp(\n  title: 'Flutter WebView Demo',\n  theme: new ThemeData(\n    primarySwatch: Colors.blue,\n  ),\n  routes: {\n    '/': (_) =\u003e const MyHomePage(title: 'Flutter WebView Demo'),\n    '/widget': (_) =\u003e new WebviewScaffold(\n      url: selectedUrl,\n      appBar: new AppBar(\n        title: const Text('Widget webview'),\n      ),\n      withZoom: true,\n      withLocalStorage: true,\n      hidden: true,\n      initialChild: Container(\n        color: Colors.redAccent,\n        child: const Center(\n          child: Text('Waiting.....'),\n        ),\n      ),\n    ),\n  },\n);\n```\n\n`FlutterWebviewPlugin` provide a singleton instance linked to one unique webview,\nso you can take control of the webview from anywhere in the app\n\nlisten for events\n\n```dart\nfinal flutterWebviewPlugin = new FlutterWebviewPlugin();\n\nflutterWebviewPlugin.onUrlChanged.listen((String url) {\n\n});\n```\n\n#### Listen for scroll event in webview\n\n```dart\nfinal flutterWebviewPlugin = new FlutterWebviewPlugin();\nflutterWebviewPlugin.onScrollYChanged.listen((double offsetY) { // latest offset value in vertical scroll\n  // compare vertical scroll changes here with old value\n});\n\nflutterWebviewPlugin.onScrollXChanged.listen((double offsetX) { // latest offset value in horizontal scroll\n  // compare horizontal scroll changes here with old value\n});\n\n````\n\nNote: Do note there is a slight difference is scroll distance between ios and android. Android scroll value difference tends to be larger than ios devices.\n\n\n#### Hidden WebView\n\n```dart\nfinal flutterWebviewPlugin = new FlutterWebviewPlugin();\n\nflutterWebviewPlugin.launch(url, hidden: true);\n```\n\n#### Close launched WebView\n\n```dart\nflutterWebviewPlugin.close();\n```\n\n#### Webview inside custom Rectangle\n\n```dart\nfinal flutterWebviewPlugin = new FlutterWebviewPlugin();\n\nflutterWebviewPlugin.launch(url,\n  fullScreen: false,\n  rect: new Rect.fromLTWH(\n    0.0,\n    0.0,\n    MediaQuery.of(context).size.width,\n    300.0,\n  ),\n);\n```\n\n#### Injecting custom code into the webview\nUse `flutterWebviewPlugin.evalJavaScript(String code)`. This function must be run after the page has finished loading (i.e. listen to `onStateChanged` for events where state is `finishLoad`).\n\nIf you have a large amount of JavaScript to embed, use an asset file. Add the asset file to `pubspec.yaml`, then call the function like:\n\n```dart\nFuture\u003cString\u003e loadJS(String name) async {\n  var givenJS = rootBundle.loadString('assets/$name.js');\n  return givenJS.then((String js) {\n    flutterWebViewPlugin.onStateChanged.listen((viewState) async {\n      if (viewState.type == WebViewState.finishLoad) {\n        flutterWebViewPlugin.evalJavascript(js);\n      }\n    });\n  });\n}\n```\n\n### Accessing local files in the file system\nSet the `withLocalUrl` option to true in the launch function or in the Webview scaffold to enable support for local URLs.\n\nNote that, on iOS, the `localUrlScope` option also needs to be set to a path to a directory. All files inside this folder (or subfolder) will be allowed access. If ommited, only the local file being opened will have access allowed, resulting in no subresources being loaded. This option is ignored on Android.\n\n### Ignoring SSL Errors\n\nSet the `ignoreSSLErrors` option to true to display content from servers with certificates usually not trusted by the Webview like self-signed certificates.\n\n**_Warning:_** Don't use this in production. \n\nNote that on iOS, you need to add new key to `ios/Runner/Info.plist`\n\n```xml\n\u003ckey\u003eNSAppTransportSecurity\u003c/key\u003e\n\u003cdict\u003e\n    \u003ckey\u003eNSAllowsArbitraryLoads\u003c/key\u003e\n    \u003ctrue/\u003e\n    \u003ckey\u003eNSAllowsArbitraryLoadsInWebContent\u003c/key\u003e\n    \u003ctrue/\u003e\n\u003c/dict\u003e\n```\n\n`NSAllowsArbitraryLoadsInWebContent` is for iOS 10+ and `NSAllowsArbitraryLoads` for iOS 9.\nOtherwise you'll still not be able to display content from pages with untrusted certificates.\n\nYou can test your ignorance if ssl certificates is working e.g. through https://self-signed.badssl.com/ \n\n\n\n\n### Webview Events\n\n- `Stream\u003cNull\u003e` onDestroy\n- `Stream\u003cString\u003e` onUrlChanged\n- `Stream\u003cWebViewStateChanged\u003e` onStateChanged\n- `Stream\u003cdouble\u003e` onScrollXChanged\n- `Stream\u003cdouble\u003e` onScrollYChanged\n- `Stream\u003cString\u003e` onError\n\n**_Don't forget to dispose webview_**\n`flutterWebviewPlugin.dispose()`\n\n### Webview Functions\n\n```dart\nFuture\u003cNull\u003e launch(String url, {\n    Map\u003cString, String\u003e headers: null,\n    Set\u003cJavascriptChannel\u003e javascriptChannels: null,\n    bool withJavascript: true,\n    bool clearCache: false,\n    bool clearCookies: false,\n    bool hidden: false,\n    bool enableAppScheme: true,\n    Rect rect: null,\n    String userAgent: null,\n    bool withZoom: false,\n    bool displayZoomControls: false,\n    bool withLocalStorage: true,\n    bool withLocalUrl: true,\n    String localUrlScope: null,\n    bool withOverviewMode: false,\n    bool scrollBar: true,\n    bool supportMultipleWindows: false,\n    bool appCacheEnabled: false,\n    bool allowFileURLs: false,\n    bool useWideViewPort: false,\n    String invalidUrlRegex: null,\n    bool geolocationEnabled: false,\n    bool debuggingEnabled: false,\n    bool ignoreSSLErrors: false,\n});\n```\n\n```dart\nFuture\u003cString\u003e evalJavascript(String code);\n```\n\n```dart\nFuture\u003cMap\u003cString, dynamic\u003e\u003e getCookies();\n```\n\n```dart\nFuture\u003cNull\u003e cleanCookies();\n```\n\n```dart\nFuture\u003cNull\u003e resize(Rect rect);\n```\n\n```dart\nFuture\u003cNull\u003e show();\n```\n\n```dart\nFuture\u003cNull\u003e hide();\n```\n\n```dart\nFuture\u003cNull\u003e reloadUrl(String url);\n```\n\n```dart\nFuture\u003cNull\u003e close();\n```\n\n```dart\nFuture\u003cNull\u003e reload();\n```\n\n```dart\nFuture\u003cNull\u003e goBack();\n```\n\n```dart\nFuture\u003cNull\u003e goForward();\n```\n\n```dart\nFuture\u003cNull\u003e stopLoading();\n```\n\n```dart\nFuture\u003cbool\u003e canGoBack();\n```\n\n```dart\nFuture\u003cbool\u003e canGoForward();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluttercommunity%2Fflutter_webview_plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffluttercommunity%2Fflutter_webview_plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluttercommunity%2Fflutter_webview_plugin/lists"}