headers property Null safety

Map<String, dynamic> headers

Map of headers to send in this response.

Where the key is the Header name and value is the Header value. Values are added to the Response body according to HttpHeaders.add.

The keys of this map are case-insensitive - they will always be lowercased. If the value is a List, each item in the list will be added separately for the same header name.

See contentType for behavior when setting 'content-type' in this property.

Implementation

Map<String, dynamic> get headers => _headers;
void headers=(Map<String, dynamic> h)

Implementation

set headers(Map<String, dynamic> h) {
  _headers.clear();
  _headers.addAll(h);
}