HttpHeaders class sealed

Constructors

HttpHeaders.list(List<(String, String)> list)
A raw header list. This allows for multiple headers with the same name.
const
factory
HttpHeaders.map(Map<HttpHeaderName, String> map)
A typed header map with a set of predefined keys.
const
factory
HttpHeaders.rawMap(Map<String, String> map)
A raw header map where the keys are strings.
const
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

containsKey(HttpHeaderName key) bool
Returns true if the headers contain the key.
copyWith({required HttpHeaderName name, required String value}) HttpHeaders
Adds a header to the headers. Returns a new instance of HttpHeaders with the added header.
copyWithout(HttpHeaderName key) HttpHeaders
Removes a header from the headers. Returns a new instance of HttpHeaders without the key.
copyWithoutRaw(String key) HttpHeaders
Removes a header from the headers. Returns a new instance of HttpHeaders without the key. Converts HttpHeaderMap to HttpHeaderRawMap.
copyWithRaw({required String name, required String value}) HttpHeaders
Adds a header to the headers. Returns a new instance of HttpHeaders with the added header. Converts HttpHeaderMap to HttpHeaderRawMap.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toMapList() Map<String, List<String>>
Converts the headers to a map where duplicate headers are represented using a list of values.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](HttpHeaderName key) String?
Returns the value of the header with the key. Returns null if the header is not found.

Constants

empty → const HttpHeaders
An empty header map.