VirtualFs class abstract

File-system abstraction consumed by every operation inside the installer/ subtree.

Two concrete implementations ship in V1: RealFs backed by dart:io and InMemoryFs backed by a Map. Both honour the same eight-method contract so InstallTransaction can swap them out in tests without code changes.

All paths are absolute. Implementations make no attempt to resolve relatives. Use the synchronous Dart File API (matches existing helpers); async variants are explicitly out of scope for V1.

Usage

const fs = RealFs();
fs.writeAsString('/tmp/hello.txt', 'world');
final hash = fs.md5('/tmp/hello.txt');
Implementers

Constructors

VirtualFs()

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

copy(String fromAbs, String toAbs) → void
Copies fromAbs to toAbs. Auto-creates any missing parent directories at the destination. Overwrites toAbs if present.
delete(String absPath) → void
Deletes the file at absPath. Silent no-op when the file is missing (idempotent, mirrors rm -f semantics).
exists(String absPath) bool
Returns true when a file (not directory) exists at absPath.
listSync(String absDir) List<String>
Returns the immediate filenames inside absDir. Non-recursive. Subdirectory names and nested files are excluded.
md5(String absPath) String
Returns the lowercase hex md5 digest of the file content at absPath. Computed on demand each call (no caching) so the result reflects the current on-disk bytes.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
readAsString(String absPath) String
Reads the file at absPath and returns its UTF-8 string content.
rename(String fromAbs, String toAbs) → void
Atomic POSIX-style rename of fromAbs to toAbs. Overwrites toAbs when present (matches rename(2) semantics used by InstallTransaction.commit's .tmp swap).
toString() String
A string representation of this object.
inherited
writeAsString(String absPath, String content) → void
Writes content to absPath (UTF-8). Auto-creates any missing parent directories. Overwrites the file when it already exists.

Operators

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