nc-photos/app/lib/mobile/android/download.dart
2022-04-06 02:37:58 +08:00

26 lines
711 B
Dart

import 'dart:async';
import 'package:flutter/services.dart';
class DownloadEvent {
static StreamSubscription<DownloadCancelEvent> listenDownloadCancel() =>
_cancelStream.listen(null);
/// User canceled the download job
static const exceptionCodeUserCanceled = "userCanceled";
static const _downloadCancelChannel = EventChannel(
"com.nkming.nc_photos/download_event/action_download_cancel");
static late final _cancelStream = _downloadCancelChannel
.receiveBroadcastStream()
.map((data) => DownloadCancelEvent(
data["notificationId"],
));
}
class DownloadCancelEvent {
const DownloadCancelEvent(this.notificationId);
final int notificationId;
}