toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  final Map<String, dynamic> data = {
    'action': action,
    'message': message,
    'token': token,
    'value': value,
  };
  if (liveCaptionsData != null) {
    data['liveCaptionsData'] = liveCaptionsData;
  }
  if (consent != null) {
    data['consent'] = consent;
  }
  if (participants != null) {
    data['participants'] = participants!.map((p) => p.toJson()).toList();
  }
  if (user != null) {
    data['user'] = user;
  }
  if (timeStamp != null) {
    data['timeStamp'] = timeStamp;
  }
  if (timestamp != null) {
    data['timestamp'] = timestamp;
  }
  if (dispatchId != null) {
    data['dispatchId'] = dispatchId;
  }
  if (id != null) {
    data['id'] = id;
  }
  if (mode != null) {
    data['mode'] = mode;
  }
  if (messageId != null) {
    data['messageId'] = messageId;
  }
  if (reaction != null) {
    data['reaction'] = reaction;
  }
  if (removeReaction != null) {
    data['removeReaction'] = removeReaction;
  }
  if (requestBy != null) {
    data['request_by'] = requestBy;
  }
  if (requestByName != null) {
    data['request_by_name'] = requestByName;
  }
  if (isScreenShareAllowed != null) {
    data['is_screen_share_allowed'] = isScreenShareAllowed;
  }
  // ✅ ADD NEW FIELD
  return data;
}