FileExistsStrategy enum

Defines the strategy to employ when a file with the target name already exists at the download location during a download request.

Inheritance
Available extensions

Values

replace → const FileExistsStrategy

Replaces the existing file. The download starts from the beginning, overwriting any existing file with the same name. This also applies if a .tmp file exists.

keepExisting → const FileExistsStrategy

Keeps the existing final file and skips the download. The operation completes successfully, returning the existing File object. No network request is made. If only a .tmp file exists, the download proceeds.

fail → const FileExistsStrategy

Fails the download operation immediately if the final file exists. Throws a FileSystemException. If only a .tmp file exists, the download proceeds.

Use this if you need strict guarantees that existing data must not be overwritten or resumed — typically in secure or one-time download scenarios.

🚫 Not recommended for most use cases. Prefer replace or resume.

resume → const FileExistsStrategy

Resumes the download if a partial file (.tmp) exists. If the final file already exists completely, behaves like keepExisting. If neither exists, starts a new download. This relies on the server supporting range requests.

Properties

hashCode int
The hash code for this object.
no setterinherited
index int
A numeric identifier for the enumerated value.
no setterinherited
name String

Available on Enum, provided by the EnumName extension

The name of the enum value.
no setter
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

values → const List<FileExistsStrategy>
A constant List of the values in this enum, in order of their declaration.