FakeCacheProvider class final

An in-memory CacheProviderContract for use in tests.

All data is stored in store — tests can read it directly to assert on what was cached, or pre-populate it before calling the system under test.

Implemented types

Constructors

FakeCacheProvider()

Properties

hashCode int
The hash code for this object.
no setterinherited
name String
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
store Map<String, dynamic>
final

Methods

clear() FutureOr<void>
override
dispose() FutureOr<void>
override
get(String? key) FutureOr<Map<String, dynamic>?>
override
getHealth() FutureOr<bool>
override
getMany(List<String> keys) FutureOr<List<Map<String, dynamic>?>>
override
getOrFail(String key, {Exception onFail()?}) FutureOr<Map<String, dynamic>>
override
has(String key) FutureOr<bool>
override
init() FutureOr<void>
override
inspect() FutureOr<Map<String, dynamic>>
override
length() FutureOr<int>
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
put<T>(String key, T object, {Duration? ttl}) FutureOr<void>
Stores object under key.
override
putMany<T>(Map<String, T> object, {Duration? ttl}) FutureOr<void>
Stores all entries from object. The optional ttl applies uniformly to every entry; pass null to skip expiration.
override
remove(String key) FutureOr<void>
override
removeMany(List<String> keys) FutureOr<void>
override
toString() String
A string representation of this object.
inherited
whereKeyStartsWith(String prefix) FutureOr<Map<String, dynamic>?>
override
whereKeyStartsWithOrFail(String prefix, {Exception onFail()?}) FutureOr<Map<String, dynamic>>
override

Operators

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