StreamRepository<K, V>.remote constructor

StreamRepository<K, V>.remote({
  1. required FetchData<K, V> fetch,
  2. CacheStorage<K, V>? storage,
  3. Duration? cacheDuration,
  4. CacheDurationResolver<K, V>? cacheDurationResolver,
})

Creates repository with providing fetch callback, typically used for REST API call. Caches data in the passed CacheStorage. The default is MemoryCacheStorage.

Implementation

StreamRepository.remote({
  required FetchData<K, V> fetch,
  CacheStorage<K, V>? storage,
  Duration? cacheDuration,
  CacheDurationResolver<K, V>? cacheDurationResolver,
}) : this._(
        fetch: fetch,
        storage: storage ?? MemoryCacheStorage<K, V>(const Uuid().v4()),
        cacheDuration: cacheDuration,
        cacheDurationResolver: cacheDurationResolver,
      );