Message constructor
Message({
- String id = '',
- required String message,
- required DateTime createdAt,
- required String sentBy,
- ReplyMessage replyMessage = const ReplyMessage(),
- Reaction? reaction,
- MessageType messageType = MessageType.text,
- Duration? voiceMessageDuration,
- 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",
);