copyWith method

Message copyWith({
  1. String? id,
  2. GlobalKey<State<StatefulWidget>>? key,
  3. String? message,
  4. DateTime? createdAt,
  5. String? sentBy,
  6. ReplyMessage? replyMessage,
  7. Reaction? reaction,
  8. MessageType? messageType,
  9. Duration? voiceMessageDuration,
  10. MessageStatus? status,
  11. bool forceNullValue = false,
})

Implementation

Message copyWith({
  String? id,
  GlobalKey? key,
  String? message,
  DateTime? createdAt,
  String? sentBy,
  ReplyMessage? replyMessage,
  Reaction? reaction,
  MessageType? messageType,
  Duration? voiceMessageDuration,
  MessageStatus? status,
  bool forceNullValue = false,
}) {
  return Message(
    id: id ?? this.id,
    message: message ?? this.message,
    createdAt: createdAt ?? this.createdAt,
    sentBy: sentBy ?? this.sentBy,
    messageType: messageType ?? this.messageType,
    voiceMessageDuration: forceNullValue
        ? voiceMessageDuration
        : voiceMessageDuration ?? this.voiceMessageDuration,
    reaction: reaction ?? this.reaction,
    replyMessage: replyMessage ?? this.replyMessage,
    status: status ?? this.status,
  );
}