FilePreferencesStore class

Transactional JSON preferences shared by Linux and Windows.

All readers and writers lock a separate stable file before migration, reading or atomic replacement. Corrupt files are preserved and reported, never reset.

Constructors

FilePreferencesStore({required Future<String?> directoryProvider(), File fileFactory(String) = File.new, Duration lockTimeout = const Duration(seconds: 10)})
Directory and file factories can be supplied by tests or host applications.

Properties

directoryProvider → Future<String?> Function()
Returns the application's support directory.
final
fileFactory → File Function(String)
Creates file handles, allowing storage failures to be injected in tests.
final
hashCode → int
The hash code for this object.
no setterinherited
lockTimeout → Duration
Maximum time to wait for another writer.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

clear(String name) → Future<void>
Clears a container, including a corrupt one, only on explicit request.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
read(String name) → Future<Map<String, Object>>
Returns a detached snapshot.
toString() → String
A string representation of this object.
inherited
update(String name, void change(Map<String, Object>)) → Future<void>
Applies an update to the latest on-disk values under one lock.

Operators

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