29 lines
670 B
Dart
29 lines
670 B
Dart
|
|
import '../incomingPacket.dart';
|
|
|
|
class FileEntry {
|
|
String name;
|
|
bool isFolder;
|
|
String path;
|
|
|
|
FileEntry(this.name, this.isFolder, this.path);
|
|
}
|
|
|
|
class FileListPacket extends IncomingPacket {
|
|
FileListPacket() : super("fileList");
|
|
|
|
List<FileEntry> _entries = List<FileEntry>.empty(growable: true);
|
|
List<FileEntry> get entries => _entries;
|
|
|
|
String _lastPath = "/";
|
|
String get lastPath => _lastPath;
|
|
|
|
@override
|
|
void handle(data) {
|
|
_entries = List<FileEntry>.empty(growable: true);
|
|
_lastPath = data['backLink'];
|
|
data['files'].forEach((value) => {
|
|
_entries.add(FileEntry(value['name'], value['is_folder'], value['path']))
|
|
});
|
|
}
|
|
} |