offline_webview 1.0.1 copy "offline_webview: ^1.0.1" to clipboard
offline_webview: ^1.0.1 copied to clipboard

A lightweight high-performance Flutter SDK for offline web package loading. Features: offline package management, URL matching, flow pipeline, WebView integration, monitoring and reporting. Supports i [...]

简体中文 | English


offline_webview #

A lightweight high-performance Flutter SDK for offline web package loading.

Features #

  • Offline Package Management: Download, cache, and serve web resources locally
  • URL Matching: Flexible rule-based URL to bisName matching
  • Flow Pipeline: Extensible chain-of-responsibility processing pipeline
  • WebView Integration: Seamless WKWebView (iOS) / WebView (Android) integration
  • Monitoring & Reporting: Built-in logging, monitoring, and data reporting

Installation #

dependencies:
  offline_webview: ^1.0.0

Quick Start #

import 'package:offline_webview/offline_webview.dart';

// Configure the SDK
final params = OfflineParams()
    .config(OfflineConfigBuilder().isOpen(true).build())
    .isDebug(true)
    .logBlock((level, message) => print(message))
    .reportBlock((event, bisName, params) => print('Report: $event'))
    .monitorBlock((type, data) => print('Monitor: $type'))
    .requestServer(YourCustomRequest());

// Initialize
await OfflineWebClient.init(params);

// Use in your app
OfflineWebView(bisName: 'your-bis-name', url: 'https://example.com/page');

Usage #

Configuration #

final config = OfflineConfigBuilder()
    .isOpen(true)                      // Enable/disable offline feature
    .addPreDownload('bis-name-1')      // Pre-download packages
    .addPreDownload('bis-name-2')
    .build();

Custom Request Implementation #

class MyRequest implements IOfflineRequest {
  @override
  void requestPackageInfo(
    String bisName,
    String version,
    RequestCallback<OfflinePackageInfo> callback,
  ) async {
    // Implement your server query logic
    final result = await fetchFromServer(bisName, version);
    callback.onSuccess(result);
  }
}

URL Matching Rules #

final rules = OfflineRuleConfig(
  rules: [
    OfflineRuleItem(host: 'example.com', path: '/app/*', bisName: 'my-app'),
  ],
);

Architecture #

+-------------------------------------------------------------+
|                     OfflineWebClient                         |
+-------------------------------------------------------------+
                            |
                            v
+-------------------------------------------------------------+
|                    OfflineWebManager                         |
+-------------------------------------------------------------+
                            |
                            v
+-------------------------------------------------------------+
|                ResourceFlow Pipeline                         |
|  FetchPackageFlow -> DownloadFlow -> ParsePackageFlow        |
|                                    -> ReplaceResFlow         |
+-------------------------------------------------------------+

Platform Support #

  • iOS (WKWebView)
  • Android (WebView)
  • Flutter Web

License #

MIT License - see LICENSE file

1
likes
0
points
21
downloads

Publisher

unverified uploader

Weekly Downloads

A lightweight high-performance Flutter SDK for offline web package loading. Features: offline package management, URL matching, flow pipeline, WebView integration, monitoring and reporting. Supports iOS WKWebView and Android WebView.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

archive, flutter, flutter_inappwebview, http, mime, path, path_provider

More

Packages that depend on offline_webview