Filesystem capability used by the harness.
Ported from pi's FileSystem interface, reduced to the operations the
session layer needs. Paths may be absolute or relative to cwd.
Invariant: operations must never throw. All filesystem failures, including unexpected backend failures, are encoded in the returned Result. Implementations must preserve this invariant.
- Implementers
Properties
Methods
-
absolutePath(
String path) → Future< Result< String, FileError> > - Returns an absolute addressed path without requiring it to exist and without resolving symlinks.
-
appendFile(
String path, String content) → Future< Result< void, FileError> > - Creates or appends to a file, creating parent directories.
-
createDir(
String path, {bool recursive = true}) → Future< Result< void, FileError> > -
Creates a directory. When
recursiveis true (the default), missing parents are created too. -
exists(
String path) → Future< Result< bool, FileError> > -
Returns
falsefor missing paths; other errors surface as Err. -
fileInfo(
String path) → Future< Result< FileInfo, FileError> > - Returns metadata for the addressed path without following symlinks.
-
joinPath(
List< String> parts) → Future<Result< String, FileError> > - Joins path segments in the filesystem namespace without requiring the result to exist.
-
listDir(
String path) → Future< Result< List< >FileInfo> , FileError> - Lists the direct children of a directory.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
readBinaryFile(
String path) → Future< Result< Uint8List, FileError> > - Reads the file as raw bytes.
-
readTextFile(
String path) → Future< Result< String, FileError> > - Reads a UTF-8 text file.
-
readTextLines(
String path, {int? maxLines}) → Future< Result< List< >String> , FileError> -
Reads UTF-8 text lines. Implementations should stop once
maxLineslines have been read. -
remove(
String path, {bool recursive = false, bool force = false}) → Future< Result< void, FileError> > -
Removes a file or directory. With
force, a missing path is not an error. -
toString(
) → String -
A string representation of this object.
inherited
-
writeBinaryFile(
String path, Uint8List content) → Future< Result< void, FileError> > - Writes raw bytes to a file, creating parent directories.
-
writeFile(
String path, String content) → Future< Result< void, FileError> > - Creates or overwrites a file, creating parent directories.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited