StorageManager class
Allows you manage your app's cloud storage buckets and files. With StorageManager you can create and list buckets and use the BucketManager to manage a specific bucket and and its contained files.
You store your files, documents, images etc. under buckets, which are the basic containers that hold your application data. You typically create a bucket and upload files/objects to this bucket.
When you deploy your app to an environment Altogic creates a default bucket
called root
. The root
bucket helps you to group your app files that are
not under any other bucket. Any file upload, which does not specify a
bucket, is uploaded to the root
bucket.
You cannot rename or delete root
bucket, but you can empty its contents
and change its default privacy setting. By default the files contained in
root
bucket is publicly accessible through their URLs. You can change
the default privacy setting of the root
bucket using the
BucketManager.makePublic or BucketManager.makePrivate methods.
Constructors
- StorageManager(Fetcher fetcher)
- Creates an instance of StorageManager to manage storage (i.e., files) of your application.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- root → BucketManager
-
Returns a BucketManager for the root bucket. It is equivalent to
calling
bucket('root')
no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
bucket(
String nameOrId) → BucketManager - Creates a new BucketManager object for the specified bucket.
-
createBucket(
String name, {bool isPublic = true, List< String> tags = const []}) → Future<APIResponse< Map< >String, dynamic> > - Creates a new bucket. If there already exists a bucket with the specified name, it returns an error.
-
deleteFile(
String fileUrl) → Future< APIError?> - Deletes a file identified by the url string. You can directly use this method to delete any file that you know its url (e.g., no need to specify bucket name/id and file name/id)
-
getStats(
) → Future< APIResponse< Map< >String, dynamic> > - Returns the overall information about your apps cloud storage including total number of buckets and files stored, total storage size in bytes and average, min and max file size in bytes.
-
listBuckets(
{String? expression, BucketListOptions? options}) → Future< APIResponse> -
Gets the list of buckets in your app cloud storage. If query
expression
is specified, it runs the specified filter query to narrow down returned results, otherwise, returns all buckets contained in your app's cloud storage. You can use the following bucket fields in your query expressions. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
searchFiles(
String expression, [FileListOptions? options]) → Future< APIResponse> - Gets the list of files matching the search expression. This method performs a global search across all the files contained in all the buckets. You can use the following file fields in your search expression.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited