Add new features and update configurations for improved functionality
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import 'dart:typed_data';
|
||||
|
||||
class Attachment {
|
||||
final String name;
|
||||
final String mimeType;
|
||||
final Uint8List data;
|
||||
final DateTime createdAt;
|
||||
|
||||
Attachment({
|
||||
required this.name,
|
||||
required this.mimeType,
|
||||
required this.data,
|
||||
DateTime? createdAt,
|
||||
}) : createdAt = createdAt ?? DateTime.now();
|
||||
|
||||
bool get isImage => mimeType.startsWith('image/');
|
||||
bool get isPdf => mimeType == 'application/pdf';
|
||||
bool get isText => mimeType.startsWith('text/');
|
||||
|
||||
int get sizeInKB => (data.length / 1024).ceil();
|
||||
String get displayName => name;
|
||||
}
|
||||
Reference in New Issue
Block a user