InMemoryVfs class final
A stateful, byte-backed Vfs.
Scripted results are FIFO and short-circuit the corresponding operation, which supports deterministic fault injection without a mocking framework.
- Implemented types
Constructors
Properties
-
directories
→ Set<
String> -
Snapshot of the stored directories.
no setter
-
files
→ Map<
String, List< int> > -
Snapshot of the stored files, deeply unmodifiable.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- modifiedAt → DateTime
-
Modified instant reported for every entry.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
createDirectory(
String path, {bool recursive = false}) → Future< Result< void> > -
Creates the directory at
path.override -
delete(
String path, {bool recursive = false}) → Future< Result< void> > -
Deletes the file or directory at
path.override -
enqueueCreateDirectoryResult(
Result< void> result) → void - Scripts the next createDirectory answer.
-
enqueueDeleteResult(
Result< void> result) → void - Scripts the next delete answer.
-
enqueueExistsResult(
Result< bool> result) → void - Scripts the next exists answer.
-
enqueueListResult(
Result< List< result) → voidVfsEntry> > - Scripts the next list answer.
-
enqueueReadBytesResult(
Result< List< result) → voidint> > - Scripts the next readBytes answer.
-
enqueueReadTextResult(
Result< String> result) → void - Scripts the next readText answer.
-
enqueueStatResult(
Result< VfsStat> result) → void - Scripts the next stat answer.
-
enqueueWriteBytesResult(
Result< void> result) → void - Scripts the next writeBytes answer.
-
enqueueWriteTextResult(
Result< void> result) → void - Scripts the next writeText answer.
-
exists(
String path) → Future< Result< bool> > -
Reports whether
pathresolves to anything.override -
list(
String path, {bool recursive = false}) → Future< Result< List< >VfsEntry> > -
Lists the entries directly (or, when
recursive, transitively) underpath.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
readBytes(
String path) → Future< Result< List< >int> > -
Reads
pathas bytes.override -
readText(
String path) → Future< Result< String> > -
Reads
pathas UTF-8 text.override -
stat(
String path) → Future< Result< VfsStat> > -
Describes
pathwithout listing its parent.override -
toString(
) → String -
A string representation of this object.
inherited
-
writeBytes(
String path, List< int> bytes, {bool createParents = false}) → Future<Result< void> > -
Writes
bytestopath, optionally creating missing parents.override -
writeText(
String path, String content, {bool createParents = false}) → Future< Result< void> > -
Writes
contenttopathas UTF-8, optionally creating missing parents.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
normalizePath(
String path) → String - Collapses empty segments and forces a leading slash.