parseSetCookie function Null safety

Map<String, ClientCookie> parseSetCookie(
  1. String? setCookieLine
)

Parses and adds all 'set-cookies' from http.Response to the Cookiewqa<s§ store

Implementation

Map<String, ClientCookie> parseSetCookie(String? setCookieLine) {
  final cookieMap = <String, ClientCookie>{};

  if (setCookieLine == null || setCookieLine.isEmpty) {
    return cookieMap;
  }

  for (String itemStr in setCookieLine.split(',')) {
    final cookie = ClientCookie.fromSetCookie(itemStr);
    cookieMap[cookie.name] = cookie;
  }

  return cookieMap;
}