webview_ultra 0.0.6+8 copy "webview_ultra: ^0.0.6+8" to clipboard
webview_ultra: ^0.0.6+8 copied to clipboard

An ultra-optimized, feature-complete, lightweight multi-platform webview plugin for Flutter (Android, iOS, macOS, Windows).

webview_ultra πŸš€ #

pub package License: MIT GitHub stars

An ultra-optimized, lightweight, and feature-complete multi-platform WebView plugin for Flutter.

Built directly on top of the official Google webview_flutter Pigeon engine (Android, iOS, macOS) and Microsoft Edge WebView2 (Windows), webview_ultra delivers 100% of the advanced power of flutter_inappwebview with zero binary bloat (~200 KB vs ~6 MB) and rock-solid engine stability.



✨ Feature Matrix & Comparison #

Feature webview_flutter flutter_inappwebview webview_ultra πŸš€
Binary Size / Overhead ~200 KB ~5–8 MB (Heavy) ~200 KB (Ultra Light)
Official Engine Stability βœ… Native Pigeon ❌ Large custom surface βœ… Official Pigeon Core
1-Line Drop-in Widget ❌ (30+ lines setup) ❌ βœ… Built-in UI & Shimmer
Reactive State (ValueNotifier) ❌ (Manual setState) ❌ βœ… Zero-Screen-Rebuild
Typed Bidirectional JS Bridge ❌ (Raw strings only) βœ… βœ… Typed JSON-RPC & Promises
User Scripts (DocumentStart/End) ⚠️ Limited βœ… βœ… Cross-Platform UserScript
Headless Off-Screen Webview ❌ βœ… βœ… HeadlessWebviewUltra
Modal In-App Browser ❌ βœ… βœ… InAppBrowserUltra
Cookie & Storage Manager ⚠️ Basic βœ… βœ… CookieManagerUltra
Content & Ad Blocker Engine ❌ βœ… βœ… Rule-based Regex Filter
Find on Page & Highlight ❌ βœ… βœ… FindInteractionController
JS Dialog Interceptions ⚠️ Complex βœ… βœ… alert, confirm, prompt
File Upload & Choosers (<input type="file">) ⚠️ Complex βœ… βœ… Auto Native + Custom Callback
Platform Support Android, iOS, macOS Android, iOS, Windows, macOS Android, iOS, macOS, Windows

πŸ“¦ Installation #

Add webview_ultra to your pubspec.yaml:

dependencies:
  webview_ultra: ^0.0.6+8

Import the package in your Dart code:

import 'package:webview_ultra/webview_ultra.dart';

πŸš€ Quick Start Guide #

1. Simple 1-Line Drop-in #

Zero configuration needed. Progress bar, error handling, and hardware acceleration are enabled by default:

import 'package:flutter/material.dart';
import 'package:webview_ultra/webview_ultra.dart';

class SimpleWebViewPage extends StatelessWidget {
  const SimpleWebViewPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('WebviewUltra')),
      body: const WebviewUltra(
        initialUrl: 'https://flutter.cn',
        showProgressBar: true,
        pullToRefresh: true,
      ),
    );
  }
}

2. Zero-Screen-Rebuild Reactive State #

WebviewUltraController exposes fine-grained ValueNotifier instances. UI subtrees update independently without triggering expensive parent widget rebuilds:

final controller = WebviewUltraController();

Scaffold(
  appBar: AppBar(
    // 1. Rebuilds ONLY the title text
    title: WebviewTitleBuilder(
      controller: controller,
      builder: (context, title, child) {
        return Text(title.isEmpty ? 'Loading...' : title);
      },
    ),
    actions: [
      // 2. Rebuilds ONLY the back/forward action buttons
      WebviewHistoryBuilder(
        controller: controller,
        builder: (context, history, child) {
          return IconButton(
            icon: const Icon(Icons.arrow_back),
            onPressed: history.canGoBack ? () => controller.goBack() : null,
          );
        },
      ),
    ],
    // 3. Rebuilds ONLY the top progress bar
    bottom: PreferredSize(
      preferredSize: const Size.fromHeight(3.0),
      child: WebviewProgressBuilder(
        controller: controller,
        builder: (context, progress, child) {
          return progress < 1.0 
              ? LinearProgressIndicator(value: progress) 
              : const SizedBox.shrink();
        },
      ),
    ),
  ),
  body: WebviewUltra(
    controller: controller,
    initialUrl: 'https://flutter.cn',
  ),
);

3. Bidirectional Typed JS-to-Dart RPC Bridge #

Execute typed Dart callbacks from JavaScript and receive Promise responses:

Dart Side:

controller.addJavaScriptHandler(
  handlerName: 'onUserLogin',
  callback: (args) {
    final token = args[0]['token'];
    print('User logged in: $token');
    return {'status': 'authenticated', 'timestamp': DateTime.now().toIso8601String()};
  },
);

JavaScript Side (inside Web page):

// Compatible with both webview_ultra and flutter_inappwebview syntax:
window.webview_ultra.callHandler('onUserLogin', { token: 'auth_jwt_token_123' })
  .then(function(response) {
    console.log('Dart response:', response.status);
  });

4. Headless Webview (Background Execution) #

Run WebViews completely off-screen without placing any widget into the widget tree (for token retrieval, web scraping, SSR pre-rendering, or preheating):

final headless = HeadlessWebviewUltra(
  initialUrl: 'https://flutter.cn',
  onPageFinished: (url) async {
    final title = await headless.evaluateJavascript('document.title');
    print('Page title fetched in background: $title');
    headless.dispose();
  },
);

await headless.run();

5. InAppBrowser Modal #

Open a standalone modal browser complete with customizable navigation controls, dynamic address bar, reload, and close buttons:

InAppBrowserUltra.open(
  context: context,
  url: 'https://flutter.cn',
  title: 'Flutter Portal',
);

Inspect, set, delete, and clear cookies across Android, iOS, macOS, and Windows:

// Set Cookie
await CookieManagerUltra.instance.setCookie(
  url: 'https://flutter.cn',
  name: 'session_id',
  value: 'xyz_789',
);

// Clear All Cookies
await CookieManagerUltra.instance.clearCookies();

7. Content & Ad Blocking Engine #

Block requests and hide elements using regex filters, ifDomain, and unlessDomain:

final controller = WebviewUltraController(
  contentBlockers: [
    ContentBlocker(
      trigger: ContentBlockerTrigger(
        urlFilter: r'.*google-analytics\.com.*',
      ),
      action: const ContentBlockerAction(
        type: ContentBlockerActionType.block,
      ),
    ),
  ],
);

8. Find-on-Page Text Search & Highlighting #

Search and traverse text occurrences directly on the rendered page:

// Find all matches on the page
final count = await controller.findController.findAll(findText: 'Flutter');

// Navigate to next or previous match
await controller.findController.findNext(forward: true);

// Clear highlights
await controller.findController.clearMatches();

9. File Uploads & File Choosers (<input type="file">) #

Support HTML file pickers natively or customize file resolution via Flutter:

WebviewUltra(
  initialUrl: 'https://html5demos.com/file-api/',
  onShowFileChooser: (WebviewFileChooserParams params) async {
    // Custom file picking using file_picker, image_picker, or local filesystem
    debugPrint('File chooser triggered for mode: ${params.mode}, accept: ${params.acceptTypes}');
    
    // Return a list of local file URIs / paths:
    // return ['/storage/emulated/0/Download/document.pdf'];
    return <String>[];
  },
);

Platform Permissions Setup

  • Android: Add camera/storage permissions in AndroidManifest.xml if your webpage captures photos or accesses media.
  • iOS: Add NSCameraUsageDescription, NSPhotoLibraryUsageDescription, and NSMicrophoneUsageDescription to ios/Runner/Info.plist.
  • macOS: Add com.apple.security.files.user-selected.read-only to macos/Runner/DebugProfile.entitlements and Release.entitlements.
  • Windows: Works automatically with system Win32 file dialogs.

πŸ› οΈ Multi-Platform Architecture #

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                                     WEBVIEW ULTRA                                      β”‚
β”‚               Unified Cross-Platform API (Android, iOS, macOS, Windows)                β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 1. Reactive State & UI   β”‚ 2. JavaScript & Interop   β”‚ 3. Storage & Security           β”‚
β”‚  β€’ ValueNotifier slices  β”‚  β€’ Typed JS RPC Bridge    β”‚  β€’ CookieManagerUltra           β”‚
β”‚  β€’ WebviewUltra Widget   β”‚  β€’ UserScript Injection   β”‚  β€’ WebStorage & Cache           β”‚
β”‚  β€’ Built-in Shimmer/Load β”‚  β€’ Alert/Confirm/Prompt   β”‚  β€’ HTTP Auth & Custom SSL       β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 4. Advanced Browsers     β”‚ 5. Hardware & Media       β”‚ 6. Content & Utilities          β”‚
β”‚  β€’ HeadlessWebviewUltra  β”‚  β€’ Auto File Chooser      β”‚  β€’ ContentBlocker Rules         β”‚
β”‚  β€’ InAppBrowserUltra     β”‚  β€’ WebRTC / Camera / Mic  β”‚  β€’ Find-on-Page & Highlighting  β”‚
β”‚  β€’ Desktop Window Props  β”‚  β€’ Download Interceptor   β”‚  β€’ PDF Export & Print Engine    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                              Platform Engine Drivers                                    β”‚
β”‚  πŸ“± Android:  webview_flutter_android (WebView + Texture Layer Hybrid Composition)      β”‚
β”‚  🍏 iOS:      webview_flutter_wkwebview (WKWebView + WKUserContentController)          β”‚
β”‚  πŸ’» macOS:    webview_flutter_wkwebview (WKWebView Desktop Bridge)                     β”‚
β”‚  πŸͺŸ Windows:  Microsoft Edge WebView2 (Chromium Engine Native Binding)                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🀝 Contributing #

Contributions are welcome! Please check out the GitHub Issues to report bugs or submit feature requests.


πŸ“„ License #

This project is licensed under the MIT License - see the LICENSE file for details.

3
likes
160
points
9
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

An ultra-optimized, feature-complete, lightweight multi-platform webview plugin for Flutter (Android, iOS, macOS, Windows).

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

file_selector, flutter, flutter_web_plugins, plugin_platform_interface, webview_flutter, webview_flutter_android, webview_flutter_platform_interface, webview_flutter_wkwebview, webview_windows

More

Packages that depend on webview_ultra

Packages that implement webview_ultra