WebViewController class

Controls a WebView provided by the host platform.

Pass this to a WebViewWidget to display the WebView.

Constructors

WebViewController()
Constructs a WebViewController.
WebViewController.fromPlatform(PlatformWebViewController platform)
Constructs a WebViewController from a specific platform implementation.
WebViewController.fromPlatformCreationParams(PlatformWebViewControllerCreationParams params)
Constructs a WebViewController from creation params for a specific platform.

Properties

hashCode int
The hash code for this object.
no setterinherited
platform → PlatformWebViewController
Implementation of PlatformWebViewController for the current platform.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addJavaScriptChannel(String name, {required void onMessageReceived(JavaScriptMessage)}) Future<void>
Adds a new JavaScript channel 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.
clearLocalStorage() Future<void>
Clears the local storage used by the WebView.
currentUrl() Future<String?>
Returns the current URL that the WebView is displaying.
enableZoom(bool enabled) Future<void>
Whether to support zooming using the on-screen zoom controls and gestures.
getScrollPosition() Future<Offset>
Returns the current scroll position of this view.
getTitle() Future<String?>
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(Uri uri, {LoadRequestMethod method = LoadRequestMethod.get, Map<String, String> headers = const <String, String>{}, Uint8List? body}) 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.
removeJavaScriptChannel(String javaScriptChannelName) Future<void>
Removes the JavaScript channel with the matching name 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<Object>
Runs the given JavaScript in the context of the current page, and returns the result.
scrollBy(int x, int y) Future<void>
Moves the scrolled position of this view.
scrollTo(int x, int y) Future<void>
Sets the scrolled position of this view.
setBackgroundColor(Color color) Future<void>
Sets the current background color of this view.
setJavaScriptMode(JavaScriptMode javaScriptMode) Future<void>
Sets the JavaScript execution mode to be used by the WebView.
setNavigationDelegate(NavigationDelegate delegate) Future<void>
Sets the NavigationDelegate containing 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.
toString() String
A string representation of this object.
inherited

Operators

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