WebViewPlatformController class abstract

Interface for talking to the webview's platform implementation.

An instance implementing this interface is passed to the onWebViewPlatformCreated callback that is passed to WebViewPlatformBuilder#onWebViewPlatformCreated.

Platform implementations that live in a separate package should extend this class rather than implement it as webview_flutter does not consider newly added methods to be breaking changes. Extending this class (using extends) ensures that the subclass will get the default implementation, while platform implementations that implements this interface will be broken by newly added WebViewPlatformController methods.


WebViewPlatformController(WebViewPlatformCallbacksHandler handler)
Creates a new WebViewPlatform.


hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited


addJavascriptChannels(Set<String> javascriptChannelNames) Future<void>
Adds new JavaScript channels to the set of enabled channels.
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.
currentUrl() Future<String?>
Accessor to the current URL that the WebView is displaying.
evaluateJavascript(String javascript) Future<String>
Evaluates a JavaScript expression in the context of the current page.
getScrollX() Future<int>
Return the horizontal scroll position of this view.
getScrollY() Future<int>
Return the vertical scroll position of this view.
getTitle() Future<String?>
Returns the title of the currently loaded page.
goBack() Future<void>
Goes back in the history of this WebView.
goForward() Future<void>
Goes forward in the history of this WebView.
loadFile(String absoluteFilePath) Future<void>
Loads the file located on the specified absoluteFilePath.
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(WebViewRequest request) Future<void>
Makes a specific HTTP request ands loads the response in the webview.
loadUrl(String url, Map<String, String>? headers) Future<void>
Loads the specified URL.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
reload() Future<void>
Reloads the current URL.
removeJavascriptChannels(Set<String> javascriptChannelNames) Future<void>
Removes JavaScript channel names from the set of enabled channels.
runJavascript(String javascript) Future<void>
Runs the given JavaScript in the context of the current page.
runJavascriptReturningResult(String javascript) Future<String>
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.
toString() String
A string representation of this object.
updateSettings(WebSettings setting) Future<void>
Updates the webview settings.


operator ==(Object other) bool
The equality operator.