StorageFolder class
Represents a scoped logical folder within the application's storage hierarchy.
The StorageFolder class serves as a bridge between the declarative storage model (StorageFolderModel) and the operational storage layer (StorageFolderImplement), providing unified access to upload, download, and local caching features within a defined path context.
Each instance of StorageFolder represents a concrete directory (or bucket segment) whose full path is derived from the combination of parent and current. Paths are automatically normalized to ensure cross-platform consistency.
This abstraction enables platform-independent file operations while maintaining predictable path resolution, making it ideal for scalable storage architectures.
Responsibilities
- Provides access to upload operations through upload.
- Provides access to download operations through download.
- Provides access to local cache operations through local.
- Automatically constructs a normalized
fullPathfor all operations.
Example
final folder = StorageFolder(parent: 'media', current: 'images');
// Upload a file to 'media/images'
await folder.upload.add(file);
// Download or retrieve a file by ID
final downloaded = await folder.download.get('photo_123');
// Access locally cached version if available
final localFile = await folder.local.get('photo_123');
Path Example
parent: "users/42"
current: "avatars"
fullPath → "users/42/avatars"
- Inheritance
-
- Object
- StorageFolderModel
- StorageFolder
- Implemented types
Constructors
- StorageFolder({String? parent, required String current})
- Represents a scoped logical folder within the application's storage hierarchy.
Properties
- current → String
-
The unique path representing the model’s current location
within the bucket hierarchy.
finalinherited
- download → StorageDownload
-
Provides access to download operations scoped to this folder.
no setteroverride
- fullPath → String
-
The fully normalized path to this folder within the storage hierarchy.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- local → LocalMedia
-
Provides access to local media management for this folder.
no setteroverride
- parent → String?
-
Represents the path to the parent container or directory, if any.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- upload → StorageUpload
-
Provides access to upload operations scoped to this folder.
no setteroverride
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited