123456789101112131415161718192021222324252627 |
- class Attachment {
- final String name;
- final String path;
- final int? size;
- final String? mimeType; // Add mimeType if available
- Attachment({required this.name, required this.path, this.size, this.mimeType});
- bool get isImage {
- final ext = link.split('.').last.toLowerCase();
- return ['jpg', 'jpeg', 'png', 'gif', 'webp'].contains(ext) ||
- (mimeType?.startsWith('image/') ?? false);
- }
- bool get isVideo {
- final ext = link.split('.').last.toLowerCase();
- return ['mp4', 'mov', 'webm', 'avi'].contains(ext) ||
- (mimeType?.startsWith('video/') ?? false);
- }
- String get link => 'https://kemono.su/data$path';
- factory Attachment.fromJson(Map<String, dynamic> json) => Attachment(
- name: json['name'],
- path: json['path'],
- );
- }
|