implemented background prefetching for files root, added 24-hour caching for root directory listing, and enabled cache renewal for manual refreshes
This commit is contained in:
@@ -11,16 +11,23 @@ class FilesDataProvider {
|
||||
/// network call is still pending. The Future itself resolves once both the
|
||||
/// cache lookup and the network attempt have settled, throwing if no payload
|
||||
/// could be obtained at all.
|
||||
///
|
||||
/// Pass [renew] for explicit user-triggered reloads (pull-to-refresh, after
|
||||
/// a rename / delete / move / upload). It bypasses the per-path TTL in
|
||||
/// [ListFilesCache] so the root listing — which is otherwise cached for a
|
||||
/// full day — still refetches when the user actively asks for it.
|
||||
Future<ListFilesResponse> listFiles(
|
||||
String path, {
|
||||
void Function(ListFilesResponse)? onCacheData,
|
||||
void Function(Object)? onError,
|
||||
bool renew = false,
|
||||
}) => resolveFromCache<ListFilesResponse>(
|
||||
(onUpdate, onError) => ListFilesCache(
|
||||
path: path,
|
||||
onUpdate: onUpdate,
|
||||
onCacheData: onCacheData,
|
||||
onError: onError,
|
||||
renew: renew,
|
||||
),
|
||||
onError: onError,
|
||||
operationName: 'listFiles',
|
||||
|
||||
Reference in New Issue
Block a user