You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
540 B
Dart
20 lines
540 B
Dart
2 months ago
|
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) return body;
|
||
|
return null;
|
||
|
}
|
||
|
}
|