addFromHeader method Null safety

void addFromHeader(
  1. String? setCookieLine
)

Parses and adds all 'set-cookies' from http.Response to the Cookie store

Implementation

void addFromHeader(String? setCookieLine) {
  if (setCookieLine == null || setCookieLine.isEmpty) {
    return;
  }

  final map = parseSetCookie(setCookieLine);

  for (String name in map.keys) {
    final ClientCookie cookie = map[name]!;
    if (cookie.value.isEmpty) {
      cookieMap.remove(name);
      continue;
    }
    cookieMap[name] = cookie;
  }
}