setCookie method

  1. @override
Future<void> setCookie(
  1. WebViewCookie cookie
)

Sets a cookie for all WebView instances.

Implementation

@override
Future<void> setCookie(WebViewCookie cookie) {
  if (!_isValidPath(cookie.path)) {
    throw ArgumentError(
        'The path property for the provided cookie was not given a legal value.');
  }

  return websiteDataStore.httpCookieStore.setCookie(
    NSHttpCookie.withProperties(
      <NSHttpCookiePropertyKey, Object>{
        NSHttpCookiePropertyKey.name: cookie.name,
        NSHttpCookiePropertyKey.value: cookie.value,
        NSHttpCookiePropertyKey.domain: cookie.domain,
        NSHttpCookiePropertyKey.path: cookie.path,
      },
    ),
  );
}