ChannelEvent.message constructor

ChannelEvent.message({
  1. required String id,
  2. required ConversationKey conversation,
  3. required String text,
  4. String? userId,
  5. String? userName,
  6. DateTime? timestamp,
  7. List<ChannelAttachment>? attachments,
  8. Map<String, dynamic>? metadata,
})

Create a message event.

Implementation

factory ChannelEvent.message({
  required String id,
  required ConversationKey conversation,
  required String text,
  String? userId,
  String? userName,
  DateTime? timestamp,
  List<ChannelAttachment>? attachments,
  Map<String, dynamic>? metadata,
}) {
  return ChannelEvent(
    id: id,
    conversation: conversation,
    type: 'message',
    text: text,
    userId: userId,
    userName: userName,
    timestamp: timestamp ?? DateTime.now(),
    attachments: attachments,
    metadata: metadata,
  );
}