Message constructor

Message({
  1. String id = '',
  2. required String message,
  3. required DateTime createdAt,
  4. required String sentBy,
  5. ReplyMessage replyMessage = const ReplyMessage(),
  6. Reaction? reaction,
  7. MessageType messageType = MessageType.text,
  8. Duration? voiceMessageDuration,
  9. MessageStatus status = MessageStatus.pending,
})

Implementation

Message({
  this.id = '',
  required this.message,
  required this.createdAt,
  required this.sentBy,
  this.replyMessage = const ReplyMessage(),
  Reaction? reaction,
  this.messageType = MessageType.text,
  this.voiceMessageDuration,
  MessageStatus status = MessageStatus.pending,
})  : reaction = reaction ?? Reaction(reactions: [], reactedUserIds: []),
      key = GlobalKey(),
      _status = ValueNotifier(status),
      assert(
        (messageType.isVoice
            ? ((defaultTargetPlatform == TargetPlatform.iOS ||
                defaultTargetPlatform == TargetPlatform.android))
            : true),
        "Voice messages are only supported with android and ios platform",
      );