applyHeader function
Creates a new Request by copying request
and adding a header with the
provided key name
and value value
to the result.
If request
already has a header with the key name
and override
is true
(default), the existing header value will be replaced with value
in the resulting Request.
final newRequest = applyHeader(request, 'Authorization', 'Bearer <token>');
Implementation
Request applyHeader(
Request request,
String name,
String value, {
bool override = true,
}) =>
applyHeaders(
request,
{name: value},
override: override,
);