getDefaultUserAgent method
- @SupportedPlatforms.new(platforms: [AndroidPlatform(apiName: 'WebSettings.getDefaultUserAgent', apiUrl: 'https://developer.android.com/reference/android/webkit/WebSettings#getDefaultUserAgent(android.content.Context)'), IOSPlatform(), MacOSPlatform(), WebPlatform(apiName: 'Navigator.userAgent', apiUrl: 'https://developer.mozilla.org/en-US/docs/Web/API/Navigator/userAgent')])
Gets the default user agent.
Officially Supported Platforms/Implementations:
- Android WebView (Official API - WebSettings.getDefaultUserAgent)
- iOS WKWebView
- macOS WKWebView
- Web <iframe> but requires same origin (Official API - Navigator.userAgent)
Use the PlatformInAppWebViewController.isMethodSupported method to check if this method is supported at runtime.
Implementation
@SupportedPlatforms(
platforms: [
AndroidPlatform(
apiName: 'WebSettings.getDefaultUserAgent',
apiUrl:
'https://developer.android.com/reference/android/webkit/WebSettings#getDefaultUserAgent(android.content.Context)',
),
IOSPlatform(),
MacOSPlatform(),
WebPlatform(
apiName: 'Navigator.userAgent',
apiUrl:
'https://developer.mozilla.org/en-US/docs/Web/API/Navigator/userAgent',
),
],
)
Future<String> getDefaultUserAgent() {
throw UnimplementedError(
'${PlatformInAppWebViewControllerMethod.getDefaultUserAgent.name} is not implemented on the current platform',
);
}