toString method Null safety

String toString()
override

String representation that is useful for debug printing

Implementation

String toString() {
  final sb = StringBuffer();

  //TODO encode all

  sb.write(name);
  sb.write('=');
  if (value is String) sb.write(value);

  if (httpOnly) {
    sb.write('; HttpOnly');
  }
  if (secure) {
    sb.write('; Secure');
  }
  if (path != null) {
    sb.write('; Path=$path');
  }
  if (domain != null) {
    sb.write('; Domain=$domain');
  }
  if (maxAge != null) {
    sb.write('; Max-Age=$maxAge');
  }
  if (expires != null) {
    sb.write('; Max-Age=${_formatDate(expires!)}');
  }

  return sb.toString();
}