operator [] method
Returns the value of the header with the key
.
Returns null if the header is not found.
Implementation
String? operator [](HttpHeaderName key) {
return switch (this) {
HttpHeaderMap map => map.map[key],
HttpHeaderRawMap rawMap => rawMap.map[key.httpName] ??
rawMap.map.entries
.firstWhereOrNull((e) => e.key.toLowerCase() == key.httpName)
?.value,
HttpHeaderList list => list.list
.firstWhereOrNull((e) => e.$1.toLowerCase() == key.httpName)
?.$2,
};
}