notificationBody method

String notificationBody(
  1. String? sender
)

Implementation

String notificationBody(String? sender) {
  final actor = (sender != null && sender.isNotEmpty) ? sender : 'Someone';
  return switch (this) {
    TextMessage m => m.text,
    ImageMessage m =>
      '$actor sent ${m.urls.length > 1 ? 'photos' : 'a photo'}',
    VideoMessage _ => '$actor sent a video',
    AudioMessage _ => '$actor sent a voice message',
    LinkMessage _ => '$actor sent a link',
    _ => '$actor sent a message',
  };
}