BucketManager class

BucketManager is primarily used to manage a bucket and its contents (e.g., files, documents, images). Using the StorageManager.bucket method, you can create a BucketManager instance for a specific bucket identified by its unique name or id.

Each object uploaded to a bucket needs to have a unique name. You cannot upload a file with the same name multiple times to a bucket.

Inheritance

Constructors

BucketManager(String bucketNameOrId, Fetcher fetcher)
Creates an instance of BucketManager 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 bucket's metadata.
delete() Future<APIError?>
Deletes the bucket and all objects (e.g., files) inside the bucket. Returns an error if root bucket is tried to be deleted.
deleteFiles(List<String> fileNamesOrIds) Future<APIError?>
Deletes multiple files identified either by their names or ids.
empty() Future<APIError?>
Removes all objects (e.g., files) inside the bucket. This method does not delete the bucket itself. If you also want to delete the bucket, including all its contained objects, you can use delete method.
exists() Future<APIResponse<bool>>
Check if the bucket exists.
file(String fileNameOrId) FileManager
Creates a new FileManager object for the specified file.
getInfo([bool detailed = false]) Future<APIResponse<Map<String, dynamic>>>
Gets information about the bucket. If detailed=true, it provides additional information about the total number of files contained, their overall total size in bytes, average, min and max file size in bytes etc.
listFiles({String? expression, FileListOptions? options}) Future<APIResponse>
Gets the list of files stored in the bucket. If query expression is specified, it runs the specified filter query to narrow down returned results, otherwise, returns all files contained in the bucket. You can use the following file fields in your query expressions.
makePrivate([bool includeFiles = false]) Future<APIResponse<Map<String, dynamic>>>
Sets the default privacy of the bucket to false. You may also choose to make the contents of the bucket publicly readable by specifying includeFiles=true. This will automatically set isPublic=false for every file in the bucket.
makePublic([bool includeFiles = false]) Future<APIResponse<Map<String, dynamic>>>
Sets the default privacy of the bucket to true. You may also choose to make the contents of the bucket publicly readable by specifying includeFiles=true. This will automatically set isPublic=true for every file in the bucket.
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 bucket's metadata.
rename(String newName) Future<APIResponse<Map<String, dynamic>>>
Renames the bucket.
toString() String
A string representation of this object.
inherited
updateInfo({required String newName, required bool isPublic, required List<String> tags, bool includeFiles = false}) Future<APIResponse<JsonMap>>
Updates the overall bucket metadata (name, isPublic and tags) in a single method call.
upload(String fileName, Uint8List fileBody, [FileUploadOptions? options]) Future<APIResponse<Map<String, dynamic>>>
Uploads a file to an existing bucket. If there already exists a file with the same name in destination bucket, it ensures the uploaded file name to be unique in its bucket.

Operators

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