Headers class

This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence.

MDN Reference

Constructors

Headers([Object? init])
The Headers() constructor creates a new Headers object.
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

append(String name, String value) → void
Appends a new value onto an existing header inside a Headers object, or adds the header if it does not already exist.
delete(String name) → void
Deletes a header from a Headers object.
entries() Iterable<(String, String)>
Returns an iterator allowing to go through all key/value pairs contained in this object.
forEach(void fn(String value, String name, Headers parent)) → void
Executes a provided function once for each key/value pair in this Headers object.
get(String name) String?
Returns a String sequence of all the values of a header within a Headers object with a given name.
getSetCookie() Iterable<String>
Returns an array containing the values of all Set-Cookie headers associated with a response.
has(String name) bool
Returns a boolean stating whether a Headers object contains a certain header.
keys() Iterable<String>
Returns an iterator allowing you to go through all keys of the key/value pairs contained in this object.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
set(String name, String value) → void
Sets a new value for an existing header inside a Headers object, or adds the header if it does not already exist.
toString() String
A string representation of this object.
inherited
values() Iterable<String>
Returns an iterator allowing you to go through all values of the key/value pairs contained in this object.

Operators

operator ==(Object other) bool
The equality operator.
inherited