ActionModel.fromJson constructor

ActionModel.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory ActionModel.fromJson(Map<String, dynamic> json) {
  return ActionModel(
    action: json['action'] as String?,
    message: json['message'] as String? ?? "",
    token: json['token'] as String? ?? "",
    value: json['value'] as bool? ?? true,
    liveCaptionsData: json['liveCaptionsData'] as TranscriptionActionModel?,
    consent: json['consent'] as String?,
    participants: (json['participants'] as List<dynamic>?)
        ?.map((e) => ConsentParticipant.fromJson(e as Map<String, dynamic>))
        .toList(),
    user: json['user'] as Map<String, dynamic>?,
    timeStamp: json['timeStamp'] as int?,
    timestamp: json['timestamp'] as int?,
    dispatchId: json['dispatchId'] as String? ?? "",
    id: json['id'] as String? ?? "",
    mode: json['mode'] as String? ?? "",
    messageId: json['messageId'] as String?,
    reaction: json['reaction'] != null
        ? Reaction.fromJson(json['reaction'] as Map<String, dynamic>)
        : null,
    removeReaction: json['removeReaction'] as bool? ?? false,
    requestBy: json['request_by'] as String? ?? "",
    requestByName: json['request_by_name'] as String? ?? "",
    isScreenShareAllowed: json['is_screen_share_allowed'] as bool? ?? false,
    // ✅ ADD NEW FIELD
  );
}