#25 new: sftp upload

This commit is contained in:
lollipopkit
2023-05-30 19:49:54 +08:00
parent a1e80fd806
commit 92ffed6541
25 changed files with 409 additions and 177 deletions

View File

@@ -0,0 +1,36 @@
import 'package:toolbox/core/provider_base.dart';
import '../model/sftp/req.dart';
class SftpProvider extends ProviderBase {
final List<SftpReqStatus> _status = [];
List<SftpReqStatus> get status => _status;
List<SftpReqStatus> gets({int? id, String? fileName}) {
var found = <SftpReqStatus>[];
if (id != null) {
found = _status.where((e) => e.id == id).toList();
}
if (fileName != null) {
found = found
.where((e) => e.item.localPath.split('/').last == fileName)
.toList();
}
return found;
}
SftpReqStatus? get({int? id, String? name}) {
final found = gets(id: id, fileName: name);
if (found.isEmpty) return null;
return found.first;
}
void add(SftpReqItem item, SftpReqType type, {String? key}) {
_status.add(SftpReqStatus(
item: item,
notifyListeners: notifyListeners,
key: key,
type: type,
));
}
}