Storage class
Provides file storage and management functionality.
The Storage class enables you to upload, download, and manage files in organized buckets. It supports various file types and provides metadata management including tags, descriptions, and content types.
Usage
final calljmp = Calljmp();
// Upload a file from bytes
final file = await calljmp.storage.upload(
content: fileBytes,
contentType: MediaType('image', 'jpeg'),
bucket: 'user-uploads',
key: 'profile/avatar.jpg',
description: 'User profile picture',
tags: ['profile', 'avatar'],
);
// Upload from file path
final document = await calljmp.storage.upload(
filePath: '/path/to/document.pdf',
bucket: 'documents',
key: 'contracts/agreement.pdf',
tags: ['legal', 'contract'],
);
// Download a file
final fileData = await calljmp.storage.download(
bucket: 'user-uploads',
key: 'profile/avatar.jpg',
);
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
-
delete(
{required String bucket, required String key}) → Future< void> - Deletes a file from a storage bucket.
-
list(
{required String bucket, int offset = 0, int? limit, String? orderDirection, String? orderField}) → Future< ({List< BucketFile> files, int? nextOffset})> -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
peek(
{required String bucket, required String key}) → Future< BucketFile> -
retrieve(
{required String bucket, required String key, int? offset, int? length}) → Future< ByteStream> - Retrieves a file or its content from a storage bucket.
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
{required String bucket, required String key, String? description, List< String> ? tags}) → Future<BucketFile> - Updates the metadata (description, tags) of a file in a storage bucket.
-
upload(
{dynamic content, String? filePath, MediaType? contentType, required String bucket, required String key, String? description, List< String> ? tags, String? sha256, String? type}) → Future<BucketFile> - Uploads a file or content to a storage bucket.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited