claude refactorings, flutter best practices, platform dependent changes, general cleanup

This commit is contained in:
2026-05-06 11:58:50 +02:00
parent 4b1d4379a0
commit 4e1272aba9
281 changed files with 1948 additions and 1041 deletions
@@ -0,0 +1,38 @@
import 'package:nextcloud/nextcloud.dart';
import '../../../../../api/marianumcloud/webdav/queries/list_files/list_files_cache.dart';
import '../../../../../api/marianumcloud/webdav/queries/list_files/list_files_response.dart';
import '../../../../../api/marianumcloud/webdav/webdav_api.dart';
class FilesDataProvider {
/// Lists files at [path]. Cached payload is delivered via [onCacheData] as
/// soon as it is read from disk, so callers can render stale data while the
/// 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.
Future<ListFilesResponse> listFiles(
String path, {
void Function(ListFilesResponse)? onCacheData,
void Function(Object)? onError,
}) async {
ListFilesResponse? latest;
Object? capturedError;
final cache = ListFilesCache(
path: path,
onUpdate: (data) => latest = data,
onCacheData: onCacheData,
onError: (e) {
capturedError = e;
onError?.call(e);
},
);
await cache.ready;
if (latest != null) return latest!;
throw capturedError ?? Exception('No data and no error from listFiles');
}
Future<void> createFolder(String fullPath) async {
final webdav = await WebdavApi.webdav;
await webdav.mkcol(PathUri.parse(fullPath));
}
}