44 lines
1.0 KiB
Dart
44 lines
1.0 KiB
Dart
import 'package:equatable/equatable.dart';
|
|
import 'dart:typed_data';
|
|
|
|
enum FileType { folder, file }
|
|
|
|
class FileItem extends Equatable {
|
|
final String name;
|
|
final String path;
|
|
final FileType type;
|
|
final int size; // in bytes, 0 for folders
|
|
final DateTime lastModified;
|
|
final String? localPath; // optional local file path for uploads
|
|
final Uint8List? bytes; // optional file bytes for web/desktop uploads
|
|
|
|
const FileItem({
|
|
required this.name,
|
|
required this.path,
|
|
required this.type,
|
|
this.size = 0,
|
|
required this.lastModified,
|
|
this.localPath,
|
|
this.bytes,
|
|
});
|
|
|
|
@override
|
|
List<Object?> get props => [name, path, type, size, lastModified];
|
|
|
|
FileItem copyWith({
|
|
String? name,
|
|
String? path,
|
|
FileType? type,
|
|
int? size,
|
|
DateTime? lastModified,
|
|
}) {
|
|
return FileItem(
|
|
name: name ?? this.name,
|
|
path: path ?? this.path,
|
|
type: type ?? this.type,
|
|
size: size ?? this.size,
|
|
lastModified: lastModified ?? this.lastModified,
|
|
);
|
|
}
|
|
}
|