getVariationsHeader method
- @SupportedPlatforms.new(platforms: [AndroidPlatform(apiName: 'WebViewCompat.getVariationsHeader', apiUrl: 'https://developer.android.com/reference/androidx/webkit/WebViewCompat#getVariationsHeader()', note: 'This method should only be called if [WebViewFeature.isFeatureSupported] returns `true` for [WebViewFeature.GET_VARIATIONS_HEADER].')])
Gets the WebView variations encoded to be used as the X-Client-Data HTTP header.
The app is responsible for adding the X-Client-Data header to any request that may use variations metadata, such as requests to Google web properties. The returned string will be a base64 encoded ClientVariations proto: https://source.chromium.org/chromium/chromium/src/+/main:components/variations/proto/client_variations.proto
The string may be empty if the header is not available.
Officially Supported Platforms/Implementations:
- Android WebView (Official API - WebViewCompat.getVariationsHeader):
- This method should only be called if WebViewFeature.isFeatureSupported returns
truefor WebViewFeature.GET_VARIATIONS_HEADER.
- This method should only be called if WebViewFeature.isFeatureSupported returns
Use the PlatformInAppWebViewController.isMethodSupported method to check if this method is supported at runtime.
Implementation
@SupportedPlatforms(
platforms: [
AndroidPlatform(
apiName: 'WebViewCompat.getVariationsHeader',
apiUrl:
'https://developer.android.com/reference/androidx/webkit/WebViewCompat#getVariationsHeader()',
note:
'This method should only be called if [WebViewFeature.isFeatureSupported] returns `true` for [WebViewFeature.GET_VARIATIONS_HEADER].',
),
],
)
Future<String?> getVariationsHeader() {
throw UnimplementedError(
'${PlatformInAppWebViewControllerMethod.getVariationsHeader.name} is not implemented on the current platform',
);
}