hunnichat/lib/utils/file_description.dart
mowetentertainment1 8ee77e3548
Some checks failed
Main Deploy Workflow / deploy_web (push) Has been cancelled
Main Deploy Workflow / deploy_playstore_internal (push) Has been cancelled
12/6/2025
2025-12-06 12:46:34 -05:00

20 lines
560 B
Dart

import 'package:matrix/matrix.dart';
extension FileDescriptionExtension on Event {
String? get fileDescription {
if (!{
MessageTypes.File,
MessageTypes.Image,
}.contains(messageType)) {
return null;
}
final formattedBody = content.tryGet<String>('formatted_body');
if (formattedBody != null) return formattedBody;
final filename = content.tryGet<String>('filename');
final body = content.tryGet<String>('body');
if (filename != body && body != null && filename != null) return body;
return null;
}
}