FileManager class
FileManager is primarily used to manage a file. Using the BucketManager.file method, you can create a FileManager instance for a specific file identified by its unique name or id.
Constructors
- FileManager(String bucketNameOrId, String fileNameOrId, Fetcher fetcher)
- Creates an instance of FileManager to manage a specific bucket of your cloud storage.
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
-
addTags(
dynamic tags) → Future< APIResponse< JsonMap> > - Adds the specified tags to file's metadata.
-
copyTo(
String bucketNameOrId) → Future< APIResponse< Map< >String, dynamic> > - Copies the file to another bucket. If there already exists a file with the same name in destination bucket, it ensures the copied file name to be unique in its new destination.
-
delete(
) → Future< APIError?> - Deletes the file from the bucket.
-
download(
) → Future< APIResponse< Uint8List> > - Downloads the file.
-
duplicate(
String duplicateName) → Future< APIResponse< Map< >String, dynamic> > - Duplicates an existing file within the same bucket.
-
exists(
) → Future< APIResponse< bool> > - Check if the file exists. It returns false if file does not exist.
-
getInfo(
) → Future< APIResponse< Map< >String, dynamic> > - Gets information about the file.
-
makePrivate(
) → Future< APIResponse< Map< >String, dynamic> > - Sets the default privacy of the file to false.
-
makePublic(
) → Future< APIResponse< Map< >String, dynamic> > - Sets the default privacy of the file to true.
-
moveTo(
String bucketNameOrId) → Future< APIResponse< Map< >String, dynamic> > - Moves the file to another bucket. The file will be removed from its current bucket and will be moved to its new bucket. If there already exists a file with the same name in destination bucket, it ensures the moved file name to be unique in its new destination.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeTags(
dynamic tags) → Future< APIResponse< JsonMap> > - Removes the specified tags from file's metadata.
-
rename(
String newName) → Future< APIResponse< Map< >String, dynamic> > - Renames the file.
-
replace(
Uint8List fileBody, [FileUploadOptions? options]) → Future< APIResponse< JsonMap> > - Replaces an existing file with another. It keeps the name of the file but replaces file contents, size, encoding and mime-type with the newly uploaded file info.
-
toString(
) → String -
A string representation of this object.
inherited
-
updateInfo(
{required String newName, required bool isPublic, required List< String> tags}) → Future<APIResponse< JsonMap> > - Updates the overall file metadata (name, isPublic and tags) in a single method call.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited