getTitle method
- @SupportedPlatforms.new(platforms: [AndroidPlatform(apiName: 'WebView.getTitle', apiUrl: 'https://developer.android.com/reference/android/webkit/WebView#getTitle()'), IOSPlatform(apiName: 'WKWebView.title', apiUrl: 'https://developer.apple.com/documentation/webkit/wkwebview/1415015-title'), MacOSPlatform(apiName: 'WKWebView.title', apiUrl: 'https://developer.apple.com/documentation/webkit/wkwebview/1415015-title'), WebPlatform(), WindowsPlatform(apiName: 'ICoreWebView2.get_DocumentTitle', apiUrl: 'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2?view=webview2-1.0.2210.55#get_documenttitle'), LinuxPlatform(apiName: 'webkit_web_view_get_title', apiUrl: 'https://wpewebkit.org/reference/stable/wpe-webkit-2.0/method.WebView.get_title.html')])
Gets the title for the current page.
Officially Supported Platforms/Implementations:
- Android WebView (Official API - WebView.getTitle)
- iOS WKWebView (Official API - WKWebView.title)
- macOS WKWebView (Official API - WKWebView.title)
- Web <iframe> but requires same origin
- Windows WebView2 (Official API - ICoreWebView2.get_DocumentTitle)
- Linux WPE WebKit (Official API - webkit_web_view_get_title)
Use the PlatformInAppWebViewController.isMethodSupported method to check if this method is supported at runtime.
Implementation
@SupportedPlatforms(
platforms: [
AndroidPlatform(
apiName: 'WebView.getTitle',
apiUrl:
'https://developer.android.com/reference/android/webkit/WebView#getTitle()',
),
IOSPlatform(
apiName: 'WKWebView.title',
apiUrl:
'https://developer.apple.com/documentation/webkit/wkwebview/1415015-title',
),
MacOSPlatform(
apiName: 'WKWebView.title',
apiUrl:
'https://developer.apple.com/documentation/webkit/wkwebview/1415015-title',
),
WebPlatform(),
WindowsPlatform(
apiName: 'ICoreWebView2.get_DocumentTitle',
apiUrl:
'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2?view=webview2-1.0.2210.55#get_documenttitle',
),
LinuxPlatform(
apiName: 'webkit_web_view_get_title',
apiUrl:
'https://wpewebkit.org/reference/stable/wpe-webkit-2.0/method.WebView.get_title.html',
),
],
)
Future<String?> getTitle() {
throw UnimplementedError(
'${PlatformInAppWebViewControllerMethod.getTitle.name} is not implemented on the current platform',
);
}