StorageDisk class abstract

The Storage Disk Contract.

This contract defines the interface for all storage disk implementations. Each disk driver (local, s3, etc.) must implement this contract.

Philosophy

The Magic Storage system is binary-first. All operations internally work with Uint8List to support images, PDFs, and other binary files seamlessly across Mobile, Desktop, and Web platforms.

Example

// Store a file
await disk.put('avatars/user.jpg', imageBytes, mimeType: 'image/jpeg');

// Retrieve a file as MagicFile
final file = await disk.getFile('avatars/user.jpg');

// Get URL for display
final url = await disk.url('avatars/user.jpg');
// Mobile: file:///path/to/file
// Web: blob:http://localhost/uuid
Implementers

Constructors

StorageDisk()

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(String path) Future<bool>
Delete a file at the given path.
download(String path, {String? name}) Future<void>
Trigger a download of the file.
exists(String path) Future<bool>
Check if a file exists at the given path.
get(String path) Future<Uint8List?>
Retrieve file contents as bytes.
getFile(String path) Future<MagicFile?>
Retrieve a file as a MagicFile.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
put(String path, dynamic contents, {String? mimeType}) Future<String>
Store contents at the given path.
toString() String
A string representation of this object.
inherited
url(String path) Future<String>
Get a URL for the file.

Operators

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