HeadlessInAppWebView constructor
HeadlessInAppWebView({
- Size initialSize = const Size(-1, -1),
- int? windowId,
- URLRequest? initialUrlRequest,
- String? initialFile,
- InAppWebViewInitialData? initialData,
- @Deprecated('Use initialSettings instead') InAppWebViewGroupOptions? initialOptions,
- InAppWebViewSettings? initialSettings,
- ContextMenu? contextMenu,
- UnmodifiableListView<
UserScript> ? initialUserScripts, - PullToRefreshController? pullToRefreshController,
- FindInteractionController? findInteractionController,
- WebViewImplementation implementation = WebViewImplementation.NATIVE,
- void onWebViewCreated(
- InAppWebViewController controller
- void onLoadStart(
- InAppWebViewController controller,
- WebUri? url
- void onLoadStop(
- InAppWebViewController controller,
- WebUri? url
- @Deprecated("Use onReceivedError instead") void onLoadError(
- InAppWebViewController controller,
- Uri? url,
- int code,
- String message,
- void onReceivedError(
- InAppWebViewController controller,
- WebResourceRequest request,
- WebResourceError error
- @Deprecated("Use onReceivedHttpError instead") void onLoadHttpError(
- InAppWebViewController controller,
- Uri? url,
- int statusCode,
- String description,
- void onReceivedHttpError(
- InAppWebViewController controller,
- WebResourceRequest request,
- WebResourceResponse errorResponse
- void onProgressChanged(
- InAppWebViewController controller,
- int progress
- void onConsoleMessage(
- InAppWebViewController controller,
- ConsoleMessage consoleMessage
- Future<
NavigationActionPolicy?> shouldOverrideUrlLoading(- InAppWebViewController controller,
- void onLoadResource(
- InAppWebViewController controller,
- LoadedResource resource
- void onScrollChanged(
- InAppWebViewController controller,
- int x,
- int y
- @Deprecated('Use onDownloadStartRequest instead') void onDownloadStart(
- InAppWebViewController controller,
- Uri url
- void onDownloadStartRequest(
- InAppWebViewController controller,
- DownloadStartRequest downloadStartRequest
- @Deprecated('Use onLoadResourceWithCustomScheme instead') Future<
CustomSchemeResponse?> onLoadResourceCustomScheme(- InAppWebViewController controller,
- Uri url
- Future<
CustomSchemeResponse?> onLoadResourceWithCustomScheme(- InAppWebViewController controller,
- WebResourceRequest request
- Future<
bool?> onCreateWindow(- InAppWebViewController controller,
- CreateWindowAction createWindowAction
- void onCloseWindow(
- InAppWebViewController controller
- Future<
JsAlertResponse?> onJsAlert(- InAppWebViewController controller,
- JsAlertRequest jsAlertRequest
- Future<
JsConfirmResponse?> onJsConfirm(- InAppWebViewController controller,
- JsConfirmRequest jsConfirmRequest
- Future<
JsPromptResponse?> onJsPrompt(- InAppWebViewController controller,
- JsPromptRequest jsPromptRequest
- Future<
HttpAuthResponse?> onReceivedHttpAuthRequest(- InAppWebViewController controller,
- URLAuthenticationChallenge challenge
- Future<
ServerTrustAuthResponse?> onReceivedServerTrustAuthRequest(- InAppWebViewController controller,
- URLAuthenticationChallenge challenge
- Future<
ClientCertResponse?> onReceivedClientCertRequest(- InAppWebViewController controller,
- URLAuthenticationChallenge challenge
- @Deprecated('Use FindInteractionController.onFindResultReceived instead') void onFindResultReceived(
- InAppWebViewController controller,
- int activeMatchOrdinal,
- int numberOfMatches,
- bool isDoneCounting,
- Future<
AjaxRequest?> shouldInterceptAjaxRequest(- InAppWebViewController controller,
- AjaxRequest ajaxRequest
- Future<
AjaxRequestAction?> onAjaxReadyStateChange(- InAppWebViewController controller,
- AjaxRequest ajaxRequest
- Future<
AjaxRequestAction> onAjaxProgress(- InAppWebViewController controller,
- AjaxRequest ajaxRequest
- Future<
FetchRequest?> shouldInterceptFetchRequest(- InAppWebViewController controller,
- FetchRequest fetchRequest
- void onUpdateVisitedHistory(
- InAppWebViewController controller,
- WebUri? url,
- bool? isReload
- @Deprecated("Use onPrintRequest instead") void onPrint(
- InAppWebViewController controller,
- Uri? url
- Future<
bool?> onPrintRequest(- InAppWebViewController controller,
- WebUri? url,
- PrintJobController? printJobController
- void onLongPressHitTestResult(
- InAppWebViewController controller,
- InAppWebViewHitTestResult hitTestResult
- void onEnterFullscreen(
- InAppWebViewController controller
- void onExitFullscreen(
- InAppWebViewController controller
- void onPageCommitVisible(
- InAppWebViewController controller,
- WebUri? url
- void onTitleChanged(
- InAppWebViewController controller,
- String? title
- void onWindowFocus(
- InAppWebViewController controller
- void onWindowBlur(
- InAppWebViewController controller
- void onOverScrolled(
- InAppWebViewController controller,
- int x,
- int y,
- bool clampedX,
- bool clampedY,
- @Deprecated('Use onSafeBrowsingHit instead') Future<
SafeBrowsingResponse?> androidOnSafeBrowsingHit(- InAppWebViewController controller,
- Uri url,
- SafeBrowsingThreat? threatType
- Future<
SafeBrowsingResponse?> onSafeBrowsingHit(- InAppWebViewController controller,
- WebUri url,
- SafeBrowsingThreat? threatType
- @Deprecated('Use onPermissionRequest instead') Future<
PermissionRequestResponse?> androidOnPermissionRequest(- InAppWebViewController controller,
- String origin,
- List<
String> resources
- Future<
PermissionResponse?> onPermissionRequest(- InAppWebViewController controller,
- PermissionRequest permissionRequest
- @Deprecated('Use onGeolocationPermissionsShowPrompt instead') Future<
GeolocationPermissionShowPromptResponse?> androidOnGeolocationPermissionsShowPrompt(- InAppWebViewController controller,
- String origin
- Future<
GeolocationPermissionShowPromptResponse?> onGeolocationPermissionsShowPrompt(- InAppWebViewController controller,
- String origin
- @Deprecated('Use onGeolocationPermissionsHidePrompt instead') void androidOnGeolocationPermissionsHidePrompt(
- InAppWebViewController controller
- void onGeolocationPermissionsHidePrompt(
- InAppWebViewController controller
- @Deprecated('Use shouldInterceptRequest instead') Future<
WebResourceResponse?> androidShouldInterceptRequest(- InAppWebViewController controller,
- WebResourceRequest request
- Future<
WebResourceResponse?> shouldInterceptRequest(- InAppWebViewController controller,
- WebResourceRequest request
- @Deprecated('Use onRenderProcessGone instead') void androidOnRenderProcessGone(
- InAppWebViewController controller,
- RenderProcessGoneDetail detail
- void onRenderProcessGone(
- InAppWebViewController controller,
- RenderProcessGoneDetail detail
- @Deprecated('Use onRenderProcessResponsive instead') Future<
WebViewRenderProcessAction?> androidOnRenderProcessResponsive(- InAppWebViewController controller,
- Uri? url
- Future<
WebViewRenderProcessAction?> onRenderProcessResponsive(- InAppWebViewController controller,
- WebUri? url
- @Deprecated('Use onRenderProcessUnresponsive instead') Future<
WebViewRenderProcessAction?> androidOnRenderProcessUnresponsive(- InAppWebViewController controller,
- Uri? url
- Future<
WebViewRenderProcessAction?> onRenderProcessUnresponsive(- InAppWebViewController controller,
- WebUri? url
- @Deprecated('Use onFormResubmission instead') Future<
FormResubmissionAction?> androidOnFormResubmission(- InAppWebViewController controller,
- Uri? url
- Future<
FormResubmissionAction?> onFormResubmission(- InAppWebViewController controller,
- WebUri? url
- @Deprecated('Use onZoomScaleChanged instead') void androidOnScaleChanged(
- InAppWebViewController controller,
- double oldScale,
- double newScale
- @Deprecated('Use onReceivedIcon instead') void androidOnReceivedIcon(
- InAppWebViewController controller,
- Uint8List icon
- void onReceivedIcon(
- InAppWebViewController controller,
- Uint8List icon
- @Deprecated('Use onReceivedTouchIconUrl instead') void androidOnReceivedTouchIconUrl(
- InAppWebViewController controller,
- Uri url,
- bool precomposed
- void onReceivedTouchIconUrl(
- InAppWebViewController controller,
- WebUri url,
- bool precomposed
- @Deprecated('Use onJsBeforeUnload instead') Future<
JsBeforeUnloadResponse?> androidOnJsBeforeUnload(- InAppWebViewController controller,
- JsBeforeUnloadRequest jsBeforeUnloadRequest
- Future<
JsBeforeUnloadResponse?> onJsBeforeUnload(- InAppWebViewController controller,
- JsBeforeUnloadRequest jsBeforeUnloadRequest
- @Deprecated('Use onReceivedLoginRequest instead') void androidOnReceivedLoginRequest(
- InAppWebViewController controller,
- LoginRequest loginRequest
- void onReceivedLoginRequest(
- InAppWebViewController controller,
- LoginRequest loginRequest
- void onPermissionRequestCanceled(
- InAppWebViewController controller,
- PermissionRequest permissionRequest
- void onRequestFocus(
- InAppWebViewController controller
- @Deprecated('Use onWebContentProcessDidTerminate instead') void iosOnWebContentProcessDidTerminate(
- InAppWebViewController controller
- void onWebContentProcessDidTerminate(
- InAppWebViewController controller
- @Deprecated('Use shouldAllowDeprecatedTLS instead') Future<
IOSShouldAllowDeprecatedTLSAction?> iosShouldAllowDeprecatedTLS(- InAppWebViewController controller,
- URLAuthenticationChallenge challenge
- Future<
ShouldAllowDeprecatedTLSAction?> shouldAllowDeprecatedTLS(- InAppWebViewController controller,
- URLAuthenticationChallenge challenge
- Future<
void> onCameraCaptureStateChanged(- InAppWebViewController controller,
- MediaCaptureState? oldState,
- MediaCaptureState? newState
- Future<
void> onMicrophoneCaptureStateChanged(- InAppWebViewController controller,
- MediaCaptureState? oldState,
- MediaCaptureState? newState
- void onContentSizeChanged(
- InAppWebViewController controller,
- Size oldContentSize,
- Size newContentSize
Class that represents a WebView in headless mode.
It can be used to run a WebView in background without attaching an InAppWebView
to the widget tree.
NOTE: Remember to dispose it when you don't need it anymore.
Supported Platforms/Implementations:
- Android native WebView
- iOS
- Web
- MacOS
Implementation
HeadlessInAppWebView(
{this.initialSize = const Size(-1, -1),
this.windowId,
this.initialUrlRequest,
this.initialFile,
this.initialData,
@Deprecated('Use initialSettings instead')
this.initialOptions,
this.initialSettings,
this.contextMenu,
this.initialUserScripts,
this.pullToRefreshController,
this.findInteractionController,
this.implementation = WebViewImplementation.NATIVE,
this.onWebViewCreated,
this.onLoadStart,
this.onLoadStop,
@Deprecated("Use onReceivedError instead")
this.onLoadError,
this.onReceivedError,
@Deprecated("Use onReceivedHttpError instead")
this.onLoadHttpError,
this.onReceivedHttpError,
this.onProgressChanged,
this.onConsoleMessage,
this.shouldOverrideUrlLoading,
this.onLoadResource,
this.onScrollChanged,
@Deprecated('Use onDownloadStartRequest instead')
this.onDownloadStart,
this.onDownloadStartRequest,
@Deprecated('Use onLoadResourceWithCustomScheme instead')
this.onLoadResourceCustomScheme,
this.onLoadResourceWithCustomScheme,
this.onCreateWindow,
this.onCloseWindow,
this.onJsAlert,
this.onJsConfirm,
this.onJsPrompt,
this.onReceivedHttpAuthRequest,
this.onReceivedServerTrustAuthRequest,
this.onReceivedClientCertRequest,
@Deprecated('Use FindInteractionController.onFindResultReceived instead')
this.onFindResultReceived,
this.shouldInterceptAjaxRequest,
this.onAjaxReadyStateChange,
this.onAjaxProgress,
this.shouldInterceptFetchRequest,
this.onUpdateVisitedHistory,
@Deprecated("Use onPrintRequest instead")
this.onPrint,
this.onPrintRequest,
this.onLongPressHitTestResult,
this.onEnterFullscreen,
this.onExitFullscreen,
this.onPageCommitVisible,
this.onTitleChanged,
this.onWindowFocus,
this.onWindowBlur,
this.onOverScrolled,
@Deprecated('Use onSafeBrowsingHit instead')
this.androidOnSafeBrowsingHit,
this.onSafeBrowsingHit,
@Deprecated('Use onPermissionRequest instead')
this.androidOnPermissionRequest,
this.onPermissionRequest,
@Deprecated('Use onGeolocationPermissionsShowPrompt instead')
this.androidOnGeolocationPermissionsShowPrompt,
this.onGeolocationPermissionsShowPrompt,
@Deprecated('Use onGeolocationPermissionsHidePrompt instead')
this.androidOnGeolocationPermissionsHidePrompt,
this.onGeolocationPermissionsHidePrompt,
@Deprecated('Use shouldInterceptRequest instead')
this.androidShouldInterceptRequest,
this.shouldInterceptRequest,
@Deprecated('Use onRenderProcessGone instead')
this.androidOnRenderProcessGone,
this.onRenderProcessGone,
@Deprecated('Use onRenderProcessResponsive instead')
this.androidOnRenderProcessResponsive,
this.onRenderProcessResponsive,
@Deprecated('Use onRenderProcessUnresponsive instead')
this.androidOnRenderProcessUnresponsive,
this.onRenderProcessUnresponsive,
@Deprecated('Use onFormResubmission instead')
this.androidOnFormResubmission,
this.onFormResubmission,
@Deprecated('Use onZoomScaleChanged instead')
this.androidOnScaleChanged,
@Deprecated('Use onReceivedIcon instead')
this.androidOnReceivedIcon,
this.onReceivedIcon,
@Deprecated('Use onReceivedTouchIconUrl instead')
this.androidOnReceivedTouchIconUrl,
this.onReceivedTouchIconUrl,
@Deprecated('Use onJsBeforeUnload instead')
this.androidOnJsBeforeUnload,
this.onJsBeforeUnload,
@Deprecated('Use onReceivedLoginRequest instead')
this.androidOnReceivedLoginRequest,
this.onReceivedLoginRequest,
this.onPermissionRequestCanceled,
this.onRequestFocus,
@Deprecated('Use onWebContentProcessDidTerminate instead')
this.iosOnWebContentProcessDidTerminate,
this.onWebContentProcessDidTerminate,
@Deprecated('Use onDidReceiveServerRedirectForProvisionalNavigation instead')
this.iosOnDidReceiveServerRedirectForProvisionalNavigation,
this.onDidReceiveServerRedirectForProvisionalNavigation,
@Deprecated('Use onNavigationResponse instead')
this.iosOnNavigationResponse,
this.onNavigationResponse,
@Deprecated('Use shouldAllowDeprecatedTLS instead')
this.iosShouldAllowDeprecatedTLS,
this.shouldAllowDeprecatedTLS,
this.onCameraCaptureStateChanged,
this.onMicrophoneCaptureStateChanged,
this.onContentSizeChanged}) {
id = IdGenerator.generate();
webViewController = new InAppWebViewController(id, this);
this._channel =
MethodChannel('com.pichillilorenzo/flutter_headless_inappwebview_$id');
this._channel.setMethodCallHandler((call) async {
try {
return await handleMethod(call);
} on Error catch (e) {
print(e);
print(e.stackTrace);
}
});
}