import 'dart:async'; import 'package:toolbox/core/provider_base.dart'; import '../model/sftp/req.dart'; class SftpProvider extends ProviderBase { final List _status = []; List get status => _status; List gets({int? id, String? fileName}) { var found = []; 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, {Completer? completer}) { _status.add(SftpReqStatus( item: item, notifyListeners: notifyListeners, type: type, completer: completer, )); } }