JsonFileStore class
A PersistentStore that writes all records to a single JSON file.
Backed by dart:io, so it works on the Dart VM, Flutter mobile, and
desktop — not the web. It is exported from
package:cachemesh/cachemesh_io.dart (not the default barrel) precisely so
importing the core library never drags in dart:io.
Operations are serialized through an internal lock so concurrent write-throughs from the cache can't corrupt the file. The whole file is rewritten on each mutation — appropriate for the modest data sizes a client-side cache holds, not a high-write server store.
New in v1.2.0.
- Implemented types
Constructors
- JsonFileStore(File file)
- JsonFileStore.atPath(String path)
- Convenience constructor from a filesystem path.
Properties
Methods
-
clear(
) → Future< void> -
Removes every record.
override
-
loadAll(
) → Future< List< PersistedRecord> > -
Loads every persisted record. Called once on Cache.hydrate.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
remove(
String key) → Future< void> -
Removes the record for
key, if present.override -
save(
PersistedRecord record) → Future< void> -
Writes (or replaces) the record for
record.key.override -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited