FileMemoryStore class

A MemoryStore that keeps each snapshot in its own JSON file.

Import it from package:ui_memory/io.dart, so that builds targeting the web never reach this library. It is available on Android, iOS, desktop and anywhere else dart:io exists.

Writes go through a temporary file and are renamed into place, so a snapshot is never left half written if the app is killed during a save. Operations are serialized: the last write always wins.

Implemented types

Constructors

FileMemoryStore(Directory directory, {String suffix = '.memory.json'})
Creates a store writing snapshots inside directory.

Properties

directory → Directory
Directory holding the snapshot files.
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
suffix → String
File name suffix of the snapshots.
final

Methods

delete(String id) → Future<void>
Deletes the snapshot stored under id.
override
fileFor(String id) → File
Path of the snapshot file for id.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
read(String id) → Future<String?>
Reads the raw snapshot stored under id, or null when there is none.
override
toString() → String
A string representation of this object.
inherited
write(String id, String value) → Future<void>
Writes value as the snapshot stored under id, replacing any old value.
override

Operators

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