setHeader method

StorageFileApi setHeader(
  1. String key,
  2. String value
)

Sets an HTTP header for subsequent requests.

Creates a shallow copy of headers to avoid mutating shared state. Returns this for method chaining.

storage.from('bucket').setHeader('x-custom-header', 'value').upload(...);

Implementation

StorageFileApi setHeader(String key, String value) {
  _headers = {..._headers, key: value};
  return this;
}