dispose method

  1. @override
Future<void> dispose()

Disposes the headless WebView.

Officially Supported Platforms/Implementations:

  • Android WebView
  • iOS WKWebView
  • macOS WKWebView
  • Web <iframe>
  • Windows WebView2
  • Linux WPE WebKit

Use the PlatformHeadlessInAppWebView.isMethodSupported method to check if this method is supported at runtime.

Implementation

@override
Future<void> dispose() async {
  if (!_running) {
    return;
  }
  Map<String, dynamic> args = <String, dynamic>{};
  await channel?.invokeMethod('dispose', args);
  disposeChannel();
  _started = false;
  _running = false;
  _webViewController?.dispose();
  _webViewController = null;
  _controllerFromPlatform = null;
  _macosParams.pullToRefreshController?.dispose();
  _macosParams.findInteractionController?.dispose();
}