DownloadBehavior class

Controls download behavior for signed and public URLs.

Passing a DownloadBehavior triggers the file to be downloaded rather than opened in the browser by setting the response's Content-Disposition header.

storage.from('docs').getPublicUrl(
  'report.pdf',
  download: DownloadBehavior.withOriginalName,
);
storage.from('docs').getPublicUrl(
  'report.pdf',
  download: DownloadBehavior.named('annual-2024.pdf'),
);

Constructors

DownloadBehavior.named(String fileName)
Triggers a download with a custom fileName.
const

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

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Constants

withOriginalName → const DownloadBehavior
Triggers a download using the file's original name.