mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
#25 new: sftp upload
This commit is contained in:
36
lib/data/provider/sftp.dart
Normal file
36
lib/data/provider/sftp.dart
Normal 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,
|
||||
));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user