add method

  1. @override
void add (String name, Object value)

Adds a header value. The header named name will have the value value added to its list of values. Some headers are single valued, and for these adding a value will replace the previous value. If the value is of type DateTime a HTTP date format will be applied. If the value is a List each element of the list will be added separately. For all other types the default toString method will be used.

Implementation

@override
void add(String name, Object value) {
  final lcName = name.toLowerCase();

  List<String> values;
  if (_data.containsKey(lcName)) {
    values = _data[lcName];
  } else {
    values = (_data[lcName] = <String>[]);
  }
  values.add(value.toString());
}