#33 new: upload file to sftp from file picker

This commit is contained in:
lollipopkit
2023-06-02 21:51:39 +08:00
parent f0bf95a7d2
commit 8c25b5e60b
24 changed files with 258 additions and 174 deletions

View File

@@ -1,3 +1,5 @@
import 'dart:async';
import '../server/server_private_info.dart';
import 'worker.dart';
@@ -24,6 +26,7 @@ class SftpReqStatus {
final SftpReqItem item;
final void Function() notifyListeners;
late SftpWorker worker;
final Completer? completer;
String get fileName => item.localPath.split('/').last;
@@ -38,12 +41,11 @@ class SftpReqStatus {
required this.item,
required this.notifyListeners,
required SftpReqType type,
String? key,
this.completer,
}) : id = DateTime.now().microsecondsSinceEpoch {
worker = SftpWorker(
onNotify: onNotify,
item: item,
privateKey: key,
type: type,
);
worker.init();
@@ -61,6 +63,7 @@ class SftpReqStatus {
status = event;
if (status == SftpWorkerStatus.finished) {
worker.dispose();
completer?.complete();
}
break;
case double: