FsOperations class abstract

Simplified filesystem operations interface based on dart:io. Provides a subset of commonly used sync operations with type safety. Allows abstraction for alternative implementations (e.g., mock, virtual).

Implementers

Constructors

FsOperations()

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

appendFileSync(String path, String data, {int? mode}) → void
Appends string to file.
copyFileSync(String src, String dest) → void
Copies file from source to destination.
cwd() → String
Gets the current working directory.
existsSync(String path) → bool
Checks if a file or directory exists.
isDirEmptySync(String path) → bool
Checks if the directory is empty.
linkSync(String target, String path) → void
Creates hard link.
lstatSync(String path) → FileStat
Gets file stats without following symlinks.
mkdir(String path, {int? mode}) → Future<void>
Creates directory recursively asynchronously.
mkdirSync(String path, {int? mode}) → void
Creates directory recursively. Mode defaults to 0o777 & ~umask if not specified.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
readdir(String path) → Future<List<Dirent>>
Lists directory contents with file type information asynchronously.
readdirStringSync(String path) → List<String>
Lists directory contents as strings.
readdirSync(String path) → List<Dirent>
Lists directory contents with file type information.
readFile(String path, {String encoding = 'utf-8'}) → Future<String>
Reads file content as string asynchronously.
readFileBytes(String path, {int? maxBytes}) → Future<Uint8List>
Reads raw file bytes as Uint8List asynchronously. When maxBytes is set, only reads up to that many bytes.
readFileBytesSync(String path) → Uint8List
Reads raw file bytes as Uint8List.
readFileSync(String path, {String encoding = 'utf-8'}) → String
Reads file content as string with specified encoding.
readlinkSync(String path) → String
Reads symbolic link.
readSync(String path, {required int length}) → ReadSyncResult
Reads specified number of bytes from file start.
realpathSync(String path) → String
Resolves symbolic links and returns the canonical pathname.
rename(String oldPath, String newPath) → Future<void>
Renames/moves file asynchronously.
renameSync(String oldPath, String newPath) → void
Renames/moves file.
rm(String path, {bool recursive, bool force}) → Future<void>
Removes files and directories asynchronously (with recursive option).
rmdir(String path) → Future<void>
Removes an empty directory asynchronously.
rmdirSync(String path) → void
Removes an empty directory.
rmSync(String path, {bool recursive, bool force}) → void
Removes files and directories (with recursive option).
stat(String path) → Future<FileStat>
Gets file stats asynchronously.
statSync(String path) → FileStat
Gets file stats.
symlinkSync(String target, String path, {String? type}) → void
Creates symbolic link.
toString() → String
A string representation of this object.
inherited
Deletes file asynchronously.
unlinkSync(String path) → void
Deletes file.

Operators

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