toReqHeader property Null safety

String toReqHeader

Returns a String representation that can be directly written http.Request header.

Implementation

String get toReqHeader {
  final removes = <String>[];
  final rets = <String>[];

  for (ClientCookie cookie in cookieMap.values) {
    if (cookie.hasExpired) {
      removes.add(cookie.name);
      continue;
    }
    rets.add(cookie.toReqHeader);
  }

  for (String rem in removes) cookieMap.remove(rem);

  return rets.join(', ');
}