Feature SDKs (Free)
webview_sdk Free
- Tier
- Freeversion 2.0.4
- Command
archipelago generate webview_sdk- Generates
features/webview/webview
Self-contained WebView feature SDK backed by
flutter_inappwebview. Provides URL loading, navigation controls, progress tracking, one-way JS calls, and URI scheme interception.
Independent of webview_sdk_advanced
webview_sdk and webview_sdk_advanced are two completely independent bricks — pick whichever one your project needs. webview_sdk_advanced does not require webview_sdk to be installed first, and does not extend or build on it. Installing both is not a supported layering model.
Variables
This brick has no configuration variables. Generation is non-interactive.
Generated Package
| Package | Description |
|---|---|
webview | Contract + flutter_inappwebview implementation, self-contained in one package: navigation controls, progress tracking, and URI scheme interception. |
Install
Interactive
archipelago generate webview_sdkNon-interactive (CI)
archipelago generate webview_sdk --config my_config.jsonGenerated Structure
features/
└── webview/
└── webview/
└── lib/src/
├── webview_controller.dart
├── webview_sdk.dart
├── webview_sdk_impl.dart
├── webview_inappwebview_controller.dart
├── di/
└── models/Platform Setup
Android — Internet Permission
Apps generated by Archipelago already declare it in android/app/src/main/AndroidManifest.xml. For an older app, add it there:
<uses-permission android:name="android.permission.INTERNET" />iOS — App Transport Security
For HTTP (non-HTTPS) URLs, add to ios/Runner/Info.plist:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>For HTTPS-only apps this is not required.
Android — R8/ProGuard
The post-gen hook appends flutter_inappwebview's keep rules to the host app's proguard-rules.pro automatically — no manual setup needed. This only applies when the host app was generated by flutter_modular_monorepo or app_scaffold (both ship the archipelago:proguard:keep-rules marker pair this brick writes into); if the marker pair is missing the contribution is skipped silently.
Public API
final webViewSDK = getIt<WebViewSDK>();
// createController returns null on platforms flutter_inappwebview does not
// support (e.g. web, desktop) — isAvailable is false there too.
if (webViewSDK.isAvailable) {
final controller = webViewSDK.createController(
const WebViewConfig(
initialUrl: 'https://example.com',
interceptedSchemes: ['app', 'tg'],
),
) as WebViewInAppWebViewController;
InAppWebView(
initialUrlRequest: URLRequest(url: WebUri(config.initialUrl)),
onWebViewCreated: (c) => controller.attachNativeController(c),
shouldOverrideUrlLoading: controller.shouldOverrideUrlLoading,
onProgressChanged: controller.onProgressChanged,
onLoadStart: controller.onLoadStart,
onLoadStop: controller.onLoadStop,
onReceivedError: controller.onReceivedError,
);
}Call controller.dispose() when the WebView is removed from the widget tree — the SDK does not do this for you.
URI Scheme Interception
controller.interceptStream.listen((event) {
// event.url → Uri, e.g. app://trade/BTC
// event.scheme → e.g. 'app'
Navigator.pushNamed(context, '/trade/${event.url.pathSegments.last}');
});One-Way JavaScript Calls
await controller.runJavaScript('window.showBanner("hello")');This package has no bidirectional JS bridge and no mini-app support. For those capabilities, install the independent webview_sdk_advanced brick.
DI & Wiring
WebViewGlobalModule is registered eagerly via ServiceLocatorUpdater in hooks/post_gen.dart, and declared under the archipelago: di_modules: manifest key in webview's pubspec.yaml so monorepo_toolkit generate host-registry can regenerate the host injector's marker regions without losing it. It registers WebViewSDK as a lazy singleton (since 2.0.0) and reads nothing from another package (depends_on is intentionally empty).
Dependencies
flutter_inappwebview: ^6.2.0-beta.3— pinned to a beta, not the stable track. The pubspec comment explains why: the last stable release (6.1.5) still callsgetDefaultProguardFile('proguard-android.txt'), which AGP 9 removed; the fix landed only influtter_inappwebview_android's 1.2.0-beta.1+. Revert to a stable^6.xonce a stableflutter_inappwebviewrelease ships this fix (upstream issue #2852).equatable: ^2.1.0, plus the workspace'sdependencies.
Limitations
isAvailableisfalse(andcreateControllerreturnsnull) on platformsflutter_inappwebviewdoesn't support (web, desktop) — always check it before using the returned controller.- Depends on a beta-track
flutter_inappwebviewrelease (see Dependencies) — re-evaluate when a stable release ships the AGP 9 fix. - No bidirectional JS bridge, no mini-app support (see above) — use
webview_sdk_advancedfor those.
Changelog
Run archipelago brick info webview_sdk to see the latest published version. Enterprise customers can read the full CHANGELOG.md in the brick source repository.