reload method
- @SupportedPlatforms.new(platforms: [AndroidPlatform(apiName: 'WebView.reload', apiUrl: 'https://developer.android.com/reference/android/webkit/WebView#reload()'), IOSPlatform(apiName: 'WKWebView.reload', apiUrl: 'https://developer.apple.com/documentation/webkit/wkwebview/1414969-reload'), MacOSPlatform(apiName: 'WKWebView.reload', apiUrl: 'https://developer.apple.com/documentation/webkit/wkwebview/1414969-reload'), WebPlatform(apiName: 'Location.reload', apiUrl: 'https://developer.mozilla.org/en-US/docs/Web/API/Location/reload', note: 'if `window.location.reload()` is not accessible inside the iframe, it will reload using the iframe `src` attribute.'), WindowsPlatform(apiName: 'ICoreWebView2.Reload', apiUrl: 'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2?view=webview2-1.0.2210.55#reload'), LinuxPlatform(apiName: 'webkit_web_view_reload', apiUrl: 'https://wpewebkit.org/reference/stable/wpe-webkit-2.0/method.WebView.reload.html')])
Reloads the WebView.
Officially Supported Platforms/Implementations:
- Android WebView (Official API - WebView.reload)
- iOS WKWebView (Official API - WKWebView.reload)
- macOS WKWebView (Official API - WKWebView.reload)
- Web <iframe> but requires same origin (Official API - Location.reload):
- if
window.location.reload()is not accessible inside the iframe, it will reload using the iframesrcattribute.
- if
- Windows WebView2 (Official API - ICoreWebView2.Reload)
- Linux WPE WebKit (Official API - webkit_web_view_reload)
Use the PlatformInAppWebViewController.isMethodSupported method to check if this method is supported at runtime.
Implementation
@SupportedPlatforms(
platforms: [
AndroidPlatform(
apiName: 'WebView.reload',
apiUrl:
'https://developer.android.com/reference/android/webkit/WebView#reload()',
),
IOSPlatform(
apiName: 'WKWebView.reload',
apiUrl:
'https://developer.apple.com/documentation/webkit/wkwebview/1414969-reload',
),
MacOSPlatform(
apiName: 'WKWebView.reload',
apiUrl:
'https://developer.apple.com/documentation/webkit/wkwebview/1414969-reload',
),
WebPlatform(
apiName: 'Location.reload',
apiUrl:
'https://developer.mozilla.org/en-US/docs/Web/API/Location/reload',
note:
'if `window.location.reload()` is not accessible inside the iframe, it will reload using the iframe `src` attribute.',
),
WindowsPlatform(
apiName: 'ICoreWebView2.Reload',
apiUrl:
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2?view=webview2-1.0.2210.55#reload',
),
LinuxPlatform(
apiName: 'webkit_web_view_reload',
apiUrl:
'https://wpewebkit.org/reference/stable/wpe-webkit-2.0/method.WebView.reload.html',
),
],
)
Future<void> reload() {
throw UnimplementedError(
'${PlatformInAppWebViewControllerMethod.reload.name} is not implemented on the current platform',
);
}