ConflictResolution enum
Strategy for handling file name conflicts when saving files.
Defines how to handle the case when a file with the same name already exists at the destination.
Values
- autoRename → const ConflictResolution
-
Automatically rename the file by appending (1), (2), etc.
Example:
- photo.jpg exists
- Saves as photo (1).jpg
- If photo (1).jpg exists, saves as photo (2).jpg
This is the default and recommended strategy for most use cases.
- overwrite → const ConflictResolution
-
Overwrite the existing file with the new file.
Platform behavior:
- iOS:
- Photos: Own files ✅ | Other apps → Creates duplicate
- Documents: ✅ Full overwrite (sandboxed per app)
- Android 9-: ✅ Full overwrite (requires WRITE_EXTERNAL_STORAGE)
- Android 10+: Own files ✅ | Other apps → Auto-rename
Important: On Android 10+, files from other apps cannot be detected. MediaStore will automatically rename your file if conflict exists (e.g., photo.jpg → photo (1).jpg).
See README.md "Overwrite Behavior" section for details.
Warning: Permanently deletes the existing file when successful.
- iOS:
- fail → const ConflictResolution
-
Fail the save operation if a file with the same name exists.
Emits SaveProgressError with a FileExistsException (error code "FILE_EXISTS").
- skip → const ConflictResolution
-
Skip the save operation if a file with the same name exists.
Emits SaveProgressComplete with the URI of the existing file. No actual file writing occurs.
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<
ConflictResolution> - A constant List of the values in this enum, in order of their declaration.