WebviewController class
Controls a WebView and provides streams for various change events.
- Inheritance
-
- Object
- ChangeNotifier
- ValueNotifier<
WebviewValue> - WebviewController
Constructors
Properties
-
containsFullScreenElementChanged
→ Stream<
bool> -
A stream reflecting whether the document currently contains full-screen elements.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
-
historyChanged
→ Stream<
HistoryChanged> -
A stream reflecting the current history state.
no setter
-
loadingState
→ Stream<
LoadingState> -
A stream reflecting the current loading state.
no setter
-
onLoadError
→ Stream<
WebErrorStatus> -
A stream reflecting the navigation error when navigation completed with an error.
no setter
-
ready
→ Future<
void> -
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
securityStateChanged
→ Stream<
String> -
A stream reflecting the current security state.
no setter
-
title
→ Stream<
String> -
A stream reflecting the current document title.
no setter
-
url
→ Stream<
String> -
A stream reflecting the current URL.
no setter
- value ↔ WebviewValue
-
The current value stored in this notifier.
getter/setter pairinherited
- webMessage → Stream
-
no setter
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
addScriptToExecuteOnDocumentCreated(
String script) → Future< ScriptID?> -
Adds the provided JavaScript
script
to a list of scripts that should be run after the global object has been created, but before the HTML document has been parsed and before any other script included by the HTML document is run. -
addVirtualHostNameMapping(
String hostName, String folderPath, WebviewHostResourceAccessKind accessKind) → Future< void> - Adds a Virtual Host Name Mapping.
-
clearCache(
) → Future< void> - Clears browser cache.
-
clearCookies(
) → Future< void> - Clears browser cookies.
-
dispose(
) → Future< void> -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
override
-
executeScript(
String script) → Future -
Runs the JavaScript
script
in the current top-level document rendered in the WebView and returns its result. -
goBack(
) → Future< void> - Navigates the WebView to the previous page in the navigation history.
-
goForward(
) → Future< void> - Navigates the WebView to the next page in the navigation history.
-
initialize(
) → Future< void> - Initializes the underlying platform view.
-
loadStringContent(
String content) → Future< void> - Loads a document from the given string.
-
loadUrl(
String url) → Future< void> -
Loads the given
url
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
openDevTools(
) → Future< void> - Opens the Browser DevTools in a separate window
-
postWebMessage(
String message) → Future< void> - Posts the given JSON-formatted message to the current document.
-
reload(
) → Future< void> - Reloads the current document.
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
removeScriptToExecuteOnDocumentCreated(
ScriptID scriptId) → Future< void> -
Removes the script identified by
scriptId
from the list of registered scripts. -
removeVirtualHostNameMapping(
String hostName) → Future< void> - Removes a Virtual Host Name Mapping.
-
resume(
) → Future< void> - Resumes the web view.
-
setBackgroundColor(
Color color) → Future< void> -
Sets the background color to the provided
color
. -
setCacheDisabled(
bool disabled) → Future< void> - Toggles ignoring cache for each request. If true, cache will not be used.
-
setFpsLimit(
[int? maxFps = 0]) → Future< void> - Limits the number of frames per second to the given value.
-
setPopupWindowPolicy(
WebviewPopupWindowPolicy popupPolicy) → Future< void> - Sets the WebviewPopupWindowPolicy.
-
setUserAgent(
String userAgent) → Future< void> - Sets the user agent value.
-
setZoomFactor(
double zoomFactor) → Future< void> - Sets the zoom factor.
-
stop(
) → Future< void> - Stops all navigations and pending resource fetches.
-
suspend(
) → Future< void> - Suspends the web view.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
getWebViewVersion(
) → Future< String?> -
Get the browser version info including channel name if it is not the
WebView2 Runtime.
Returns
null
if the webview2 runtime is not installed. -
initializeEnvironment(
{String? userDataPath, String? browserExePath, String? additionalArguments}) → Future< void> -
Explicitly initializes the underlying WebView environment
using an optional
browserExePath
, an optionaluserDataPath
and optional Chromium command line argumentsadditionalArguments
.