dart format

This commit is contained in:
2026-05-08 20:12:40 +02:00
parent 9e139b5704
commit 3b8da1d3d6
295 changed files with 6404 additions and 4161 deletions
+2 -1
View File
@@ -8,7 +8,8 @@ import 'dart:async';
class CacheInvalidationBus {
CacheInvalidationBus._();
static final StreamController<String> _listFiles = StreamController<String>.broadcast();
static final StreamController<String> _listFiles =
StreamController<String>.broadcast();
/// Emits the invalidated `pathString` (in `FilesBloc` format: relative,
/// no leading or trailing slash; root is '/').
+7 -2
View File
@@ -49,7 +49,9 @@ class DownloadJob {
final String localPath;
final FileDownloader _downloader;
final ValueNotifier<DownloadStatus> status = ValueNotifier(const DownloadInProgress(0));
final ValueNotifier<DownloadStatus> status = ValueNotifier(
const DownloadInProgress(0),
);
bool _disposed = false;
bool get isFinished =>
@@ -86,7 +88,10 @@ class DownloadManager {
/// Returns the existing job if a download is in progress for [remotePath],
/// otherwise starts a new one. Caller listens on [DownloadJob.status].
Future<DownloadJob> start({required String remotePath, required String name}) async {
Future<DownloadJob> start({
required String remotePath,
required String name,
}) async {
final existing = _jobs[remotePath];
if (existing != null && !existing.isFinished) return existing;
if (existing != null) {
+19 -15
View File
@@ -28,20 +28,24 @@ class FileDownloader {
required void Function() onDone,
required void Function(Object error) onError,
}) {
client.download(
url,
savePath,
cancelToken: _cancelToken,
onReceiveProgress: (received, total) {
if (_cancelled || total <= 0) return;
onProgress((received / total) * 100);
},
).then((_) {
if (_cancelled) return;
onDone();
}).catchError((Object error) {
if (_cancelled) return;
onError(error);
}).ignore();
client
.download(
url,
savePath,
cancelToken: _cancelToken,
onReceiveProgress: (received, total) {
if (_cancelled || total <= 0) return;
onProgress((received / total) * 100);
},
)
.then((_) {
if (_cancelled) return;
onDone();
})
.catchError((Object error) {
if (_cancelled) return;
onError(error);
})
.ignore();
}
}
+1 -1
View File
@@ -3,7 +3,7 @@ import 'package:url_launcher/url_launcher_string.dart';
class UrlOpener {
static Future<void> onOpen(LinkableElement link) async {
if(await canLaunchUrlString(link.url)) {
if (await canLaunchUrlString(link.url)) {
await launchUrlString(link.url);
}
}