CkStorage class abstract

Secure storage with guaranteed fallback + zero-latency in-memory cache.

Read layer : memory cache → (miss) disk read → populate cache Write layer : update cache immediately, persist to disk in background Delete layer: evict from cache, delete from disk deleteAll : wipe cache, wipe disk

Disk chain : FlutterSecureStorage → SharedPreferences (plain fallback) NEVER fails — always has an alternative.

Constructors

CkStorage()

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

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

delete(String key) Future<void>
Deletes key from both the memory cache and disk.
deleteAll() Future<void>
Clears ALL stored keys and values from both memory cache and disk, EXCEPT keys registered via protectKey (e.g. the persistent device id), whose values are preserved.
initialize() Future<void>
protectKey(String key) → void
Marks key as protected so it is preserved across deleteAll.
read(String key) Future<String?>
Reads the value for key. Returns from memory cache on every hit — O(1), no I/O. Since _cache is pre-populated during initialize(), this is a guaranteed cache hit.
resetForTests() → void
Resets internal state for unit testing (bypasses platform plugins). Call this in setUp to get a clean slate without disk I/O.
seedForTests(String key, String value) → void
Seeds a key/value directly into the in-memory cache for test setup.
write(String key, String value) Future<void>
Writes value for key. Cache is updated synchronously before returning so subsequent reads are instant. Disk persistence runs concurrently in the background.