cookiesFromSetCookie static method

List<Cookie> cookiesFromSetCookie(
  1. String setCookie
)

Returns a list of Cookies extracted from the setCookie string, which is the value of the 'Set-Cookie' header of a server response

Based on https://github.com/dart-lang/http/pull/688/files

Implementation

static List<Cookie> cookiesFromSetCookie(String setCookie) {
  final cookies = <Cookie>[];
  if (setCookie.isNotEmpty) {
    for (final cookie in setCookie.split(_regexSplitSetCookies)) {
      cookies.add(Cookie.fromSetCookieValue(cookie));
    }
  }
  return cookies;
}