FileLocalRepository class

A LocalRepository that persists to the device's temporary directory.

This is the batteries-included implementation: it survives app restarts and needs no third-party storage package, so caching works without writing an adapter first.

GetIt.I.registerSingleton<LocalRepository>(FileLocalRepository());

Swap it for MapRepository in tests, or supply your own implementation backed by Hive, Isar or shared_preferences — nothing above the LocalRepository interface changes.

Implemented types

Constructors

FileLocalRepository({CacheManager? cacheManager})

Properties

hashCode int
The hash code for this object.
no setterinherited
isInitialized bool
getter/setter pairoverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

checkCache(String key) Future<bool>
check time storage if cached data exists and is valid key - the key used to store the data data - string version of the data to be stored
override
clearCache() → void
clear all content from cache
override
getData(String key) Future
get stored data from local database.
override
getTime(String key) Future<int?>
override
init() Future
initialize instance of database
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeData(String key) → void
remove a cached content from cache key - the key used to store the data
override
saveData(String key, String data) Future
get stored data from local database key - the key used to store the data data - string version of the data to be stored
override
saveTime(String key, int duration) → void
save expiry time in milliseconds for this data key - the key used to store the data duration - duration of cache in seconds
override
toString() String
A string representation of this object.
inherited

Operators

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