BaiomyStorageRepo class

A professional, singleton-based Firebase Storage repository.

Mirrors the patterns used in BaiomyAuthRepo and BaiomyFirestoreRepo.

Usage:

final url = await BaiomyStorageRepo.instance.uploadFile(
  path: 'users/uid123/avatar.jpg',
  file: File('/local/path/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

deleteAll({required String path}) Future<void>
Recursively deletes all files and sub-folders under path.
deleteFile({required String path}) Future<void>
Deletes the file at path.
deleteFolder({required String path}) Future<void>
Deletes all files directly inside path (non-recursive).
downloadBytes({required String path, int maxSize = 10 * 1024 * 1024}) Future<Uint8List?>
Downloads the file at path into memory and returns its bytes.
fileExists({required String path}) Future<bool>
Checks whether a file exists at path.
getDownloadUrl({required String path}) Future<String>
Returns the public download URL for the file at path.
getMetadata({required String path}) Future<FullMetadata>
Returns the FullMetadata for the file at path.
listAll({required String path}) Future<ListResult>
Recursively lists all items under path, including sub-folders.
listItems({required String path}) Future<ListResult>
Lists all items (files) directly inside a storage path.
listItemsPaginated({required String path, int maxResults = 20, String? pageToken}) Future<ListResult>
Lists items inside path with pagination support.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
updateBytes({required String path, required Uint8List newBytes, SettableMetadata? metadata}) Future<String>
Updates (replaces) the file at path with new bytes.
updateFile({required String path, required File newFile, SettableMetadata? metadata}) Future<String>
Updates (replaces) the file at path with a new File.
updateMetadata({required String path, required SettableMetadata metadata}) Future<FullMetadata>
Updates only the metadata of the file at path without re-uploading the file itself.
uploadBytes({required String path, required Uint8List bytes, SettableMetadata? metadata}) Future<String>
Uploads raw bytes to path and returns its public download URL.
uploadFile({required String path, required File file, SettableMetadata? metadata}) Future<String>
Uploads a File to path and returns its public download URL.
uploadFileWithProgress({required String path, required File file, SettableMetadata? metadata}) → UploadTask
Uploads a File and exposes a TaskSnapshot stream to track progress.
uploadFromString({required String path, required String fileUrl, PutStringFormat format = PutStringFormat.raw, SettableMetadata? metadata}) Future<String>
Uploads a file from a fileUrl string to path and returns the public download URL.

Operators

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

Static Properties

instance BaiomyStorageRepo
The singleton instance of BaiomyStorageRepo.
no setter