WebKitWebViewController class
An implementation of PlatformWebViewController with the WebKit api.
- Inheritance
-
- Object
- PlatformInterface
- WebKitWebViewController
Constructors
- WebKitWebViewController(PlatformWebViewControllerCreationParams params)
- Constructs a WebKitWebViewController.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- params → PlatformWebViewControllerCreationParams
-
The parameters used to initialize the
PlatformWebViewController.finalinherited - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- webViewIdentifier → int
-
Identifier used to retrieve the underlying native
WKWebView.no setter
Methods
-
addJavaScriptChannel(
JavaScriptChannelParams javaScriptChannelParams) → Future< void> - Adds a new JavaScript channel to the set of enabled channels.
-
addUserScript(
WebViewUserScript userScript) → Future< String> -
Registers
userScriptfor injection into future documents. -
buildUserScriptSource(
WebViewUserScript userScript, {required bool platformHandlesMainFrameOnly}) → String -
Builds the source installed by a platform user-script implementation.
inherited
-
callAsyncJavaScript(
JavaScriptInvocationParams params) → Future< Object?> - Invokes an asynchronous JavaScript function and waits for its result.
-
canGoBack(
) → Future< bool> - Checks whether there's a back history item.
-
canGoForward(
) → Future< bool> - Checks whether there's a forward history item.
-
clearCache(
) → Future< void> -
Clears all caches used by the
WebView. -
clearLocalStorage(
) → Future< void> -
Clears the local storage used by the
WebView. -
closeOffscreenWebView(
) → Future< void> - Releases a controller owned by an offscreen session.
-
currentUrl(
) → Future< String?> - Accessor to the current URL that the WebView is displaying.
-
enableZoom(
bool enabled) → Future< void> - Whether to support zooming using its on-screen zoom controls and gestures.
-
getScrollPosition(
) → Future< Offset> - Return the current scroll position of this view.
-
getTitle(
) → Future< String?> - Returns the title of the currently loaded page.
-
getUserAgent(
) → Future< String?> -
Gets the value used for the HTTP
User-Agent:request header. -
goBack(
) → Future< void> - Goes back in the history of this WebView.
-
goForward(
) → Future< void> - Goes forward in the history of this WebView.
-
isOffscreenWebViewSupported(
) → Future< bool> - Whether this controller can operate without a platform WebView widget.
-
isUserScriptInjectionSupported(
WebViewUserScriptInjectionTime injectionTime) → Future< bool> - Whether deterministic user-script injection is supported.
-
loadFile(
String absoluteFilePath) → Future< void> -
Loads the file located on the specified
absoluteFilePath. -
loadFileWithParams(
LoadFileParams params) → Future< void> -
Loads a local HTML file using the provided
params. -
loadFlutterAsset(
String key) → Future< void> - Loads the Flutter asset specified in the pubspec.yaml file.
-
loadHtmlString(
String html, {String? baseUrl}) → Future< void> - Loads the supplied HTML string.
-
loadRequest(
LoadRequestParams params) → Future< void> - Makes a specific HTTP request ands loads the response in the webview.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reload(
) → Future< void> - Reloads the current URL.
-
removeAllUserScripts(
) → Future< void> - Removes all scripts registered through addUserScript.
-
removeJavaScriptChannel(
String javaScriptChannelName) → Future< void> - Removes the JavaScript channel with the matching name from the set of enabled channels.
-
removeUserScript(
String identifier) → Future< void> - Removes a user script previously registered by addUserScript.
-
runJavaScript(
String javaScript) → Future< void> - Runs the given JavaScript in the context of the current page.
-
runJavaScriptReturningResult(
String javaScript) → Future< Object> - Runs the given JavaScript in the context of the current page, and returns the result.
-
scrollBy(
int x, int y) → Future< void> - Move the scrolled position of this view.
-
scrollTo(
int x, int y) → Future< void> - Set the scrolled position of this view.
- Whether horizontal swipe gestures trigger page navigation.
-
setAllowsLinkPreview(
bool allow) → Future< void> - Whether to allow previews for link destinations and detected data such as addresses and phone numbers.
-
setBackgroundColor(
Color color) → Future< void> - Set the current background color of this view.
-
setHorizontalScrollBarEnabled(
bool enabled) → Future< void> - Whether the horizontal scrollbar should be drawn or not.
-
setInspectable(
bool inspectable) → Future< void> - Whether to enable tools for debugging the current WKWebView content.
-
setJavaScriptMode(
JavaScriptMode javaScriptMode) → Future< void> - Sets the JavaScript execution mode to be used by the webview.
-
setOnCanGoBackChange(
void onCanGoBackChangeCallback(bool)) → Future< void> - Sets the listener for canGoBack changes.
-
setOnConsoleMessage(
void onConsoleMessage(JavaScriptConsoleMessage consoleMessage)) → Future< void> - Sets a callback that notifies the host application of any log messages written to the JavaScript console.
-
setOnJavaScriptAlertDialog(
Future< void> onJavaScriptAlertDialog(JavaScriptAlertDialogRequest request)) → Future<void> - Sets a callback that notifies the host application that the web page wants to display a JavaScript alert() dialog.
-
setOnJavaScriptConfirmDialog(
Future< bool> onJavaScriptConfirmDialog(JavaScriptConfirmDialogRequest request)) → Future<void> - Sets a callback that notifies the host application that the web page wants to display a JavaScript confirm() dialog.
-
setOnJavaScriptTextInputDialog(
Future< String> onJavaScriptTextInputDialog(JavaScriptTextInputDialogRequest request)) → Future<void> - Sets a callback that notifies the host application that the web page wants to display a JavaScript prompt() dialog.
-
setOnPlatformPermissionRequest(
void onPermissionRequest(PlatformWebViewPermissionRequest request)) → Future< void> - Sets a callback that notifies the host application that web content is requesting permission to access the specified resources.
-
setOnScrollPositionChange(
void onScrollPositionChange(ScrollPositionChange scrollPositionChange)?) → Future< void> - Sets the listener for content offset changes.
-
setOverScrollMode(
WebViewOverScrollMode mode) → Future< void> - Sets the over-scroll mode for the WebView.
-
Sets the
PlatformNavigationDelegatecontaining the callback methods that are called during navigation events. -
setUserAgent(
String? userAgent) → Future< void> -
Sets the value used for the HTTP
User-Agent:request header. -
setVerticalScrollBarEnabled(
bool enabled) → Future< void> - Whether the vertical scrollbar should be drawn or not.
-
supportsSetScrollBarsEnabled(
) → bool - Returns true if the current platform supports setting whether scrollbars should be drawn or not.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited