DriveManager class
Holds named disks and picks the right one.
DriveManager drive = DriveManager(
defaultDisk: 'local',
disks: <String, DriverContract>{
'local': LocalDriver(LocalDriverConfig(root: 'storage')),
's3': S3Driver(S3DriverConfig(...)),
},
);
await drive.use('s3').put('a.txt', 'hello');
Constructors
-
DriveManager({required String defaultDisk, Map<
String, DriverContract> disks = const <String, DriverContract>{}})
Properties
- defaultDisk → String
-
Name of the disk that use returns when no name is given.
final
-
diskNames
→ Iterable<
String> -
Names of all registered disks.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
fake(
[String? name]) → Disk - Swap a disk with an in-memory fake until restore is called. Returns the fake disk so a test can check what was written.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
register(
String name, DriverContract driver) → void - Add or replace a disk. Use this for your own drivers too.
-
restore(
[String? name]) → void - Put the real disk back after fake.
-
restoreAll(
) → void - Remove all fakes.
-
toString(
) → String -
A string representation of this object.
inherited
-
use(
[String? name]) → Disk - Get a disk by name. Without a name, returns the default disk.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited