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:
2026-05-09 23:39:06 +02:00
parent 14090b96f4
commit bf28a678c9
4 changed files with 67 additions and 3 deletions
@@ -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',