setAcceptThirdPartyCookies method

Future<void> setAcceptThirdPartyCookies(
  1. AndroidWebViewController controller,
  2. bool accept
)

Sets whether the WebView should allow third party cookies to be set.

Apps that target Build.VERSION_CODES.KITKAT or below default to allowing third party cookies. Apps targeting Build.VERSION_CODES.LOLLIPOP or later default to disallowing third party cookies.

Implementation

Future<void> setAcceptThirdPartyCookies(
  AndroidWebViewController controller,
  bool accept,
) {
  // ignore: invalid_use_of_visible_for_testing_member
  final WebView webView = WebView.api.instanceManager
      .getInstanceWithWeakReference(controller.webViewIdentifier)!;
  return _cookieManager.setAcceptThirdPartyCookies(webView, accept);
}