TomMemoryFileSystem class
Files and folders keyed by their absolute path. Writes are atomic by construction, revisions are checked like on disk, there is no trash, and watch reports every change made through it.
- Inheritance
-
- Object
- TomFileSystemBase
- TomMemoryFileSystem
- Available extensions
Constructors
-
TomMemoryFileSystem({Uri? root, Map<
String, String> seed = const {}}) -
rootdefaults to/;seedmaps absolute paths to text.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
onDidChange
→ Stream<
TomFileChangeEvent> -
Every create, write, rename and delete made through this file system.
no setterinherited
-
onDidSave
→ Stream<
Uri> -
no setterinherited
-
onWillSave
→ Stream<
TomWillSaveEvent> -
no setterinherited
-
paths
→ List<
String> -
The paths of every file, sorted — for tests.
no setter
- root → Uri
-
The root directory, as an absolute directory URI (trailing
/).finalinherited - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
absolute(
Uri uri) → Uri -
urimade absolute against root.inherited -
create(
Uri uri, {bool directory = false}) → Future< void> -
Creates an empty file, or with
directorya folder with its parents. A file that already exists is refused.override -
delete(
Uri uri) → Future< void> -
Deletes
urifor good — a folder with everything in it.override -
dispose(
) → Future< void> -
Ends the event streams.
override
-
emitChange(
Uri uri, TomFileChangeType type) → void -
Announces a change made through this file system.
inherited
-
ensureFolder(
Uri folder) → Future< void> -
Available on TomFileSystem, provided by the TomFileSystemFolders extension
Makesfolder(and its parents) when it does not exist. -
exists(
Uri uri) → Future< bool> -
Whether
uriexists.override -
folderOf(
Uri uri) → Uri -
Available on TomFileSystem, provided by the TomFileSystemFolders extension
The folder holdinguri. -
list(
Uri directory) → Future< List< TomFileEntry> > -
The entries of the directory
directory— one level, unsorted.override -
nameOf(
Uri uri) → String -
The last segment of
uri's path — a file's or folder's own name.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pathOf(
Uri uri) → String? -
uri's path relative to root, or null when it lies outside it.inherited -
read(
Uri uri) → Future< TomFileContent> -
The bytes of
uriand the revision they were read at.override -
readSlice(
Uri uri, {required int maxBytes, required bool fromEnd}) → Future< String?> -
At most
maxBytesofurias text, from its end whenfromEndand from its start otherwise — or null when it does not exist.override -
readText(
Uri uri) → Future< String> -
The text of
uri, decoded as UTF-8.inherited -
readTextIfExists(
Uri uri) → Future< String?> -
Available on TomFileSystem, provided by the TomFileSystemFolders extension
The text ofuri, or null when it does not exist. -
rename(
Uri from, Uri to) → Future< void> -
Renames or moves
fromtoto; an existingtois refused.override -
save(
Uri uri) → Future< void> -
Announces that
uriis saved: onWillSave with its text, then onDidSave.inherited -
stat(
Uri uri) → Future< TomFileEntry?> -
uri's entry without reading it, or null when it does not exist.override -
toString(
) → String -
A string representation of this object.
inherited
-
trash(
Uri uri) → Future< bool> -
There is no trash in memory: the caller asks before delete.
override
-
uriOf(
String path) → Uri -
The absolute URI of
path, relative to root with/separators.inherited -
watch(
{bool descend(String path)?}) → Stream< TomFileChange> ? -
Changes under root, or null when the platform refuses to watch.
override
-
write(
Uri uri, Uint8List bytes, {TomFileRevision? expected}) → Future< TomFileRevision> -
Writes
bytestouriatomically. Withexpected, refuses with a TomFileConflict when the file is no longer that revision. Answers the revision written.override -
writeText(
Uri uri, String text, {TomFileRevision? expected}) → Future< TomFileRevision> -
write of
textas UTF-8.inherited -
writeTextMakingFolder(
Uri uri, String text) → Future< TomFileRevision> -
Available on TomFileSystem, provided by the TomFileSystemFolders extension
writeText oftexttouri, making its folder first when it is missing.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited