fromJson static method

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

Implementation

static GroupCall? fromJson(Map<String, dynamic>? json) {
  if (json == null) {
    return null;
  }

  return GroupCall(
    id: (json['id'] as int?) ?? 0,
    uniqueId:
        int.tryParse((json['unique_id'] as dynamic)?.toString() ?? '') ?? 0,
    title: (json['title'] as String?) ?? '',
    inviteLink: (json['invite_link'] as String?) ?? '',
    paidMessageStarCount: (json['paid_message_star_count'] as int?) ?? 0,
    scheduledStartDate: (json['scheduled_start_date'] as int?) ?? 0,
    enabledStartNotification:
        (json['enabled_start_notification'] as bool?) ?? false,
    isActive: (json['is_active'] as bool?) ?? false,
    isVideoChat: (json['is_video_chat'] as bool?) ?? false,
    isLiveStory: (json['is_live_story'] as bool?) ?? false,
    isRtmpStream: (json['is_rtmp_stream'] as bool?) ?? false,
    isJoined: (json['is_joined'] as bool?) ?? false,
    needRejoin: (json['need_rejoin'] as bool?) ?? false,
    isOwned: (json['is_owned'] as bool?) ?? false,
    canBeManaged: (json['can_be_managed'] as bool?) ?? false,
    participantCount: (json['participant_count'] as int?) ?? 0,
    hasHiddenListeners: (json['has_hidden_listeners'] as bool?) ?? false,
    loadedAllParticipants:
        (json['loaded_all_participants'] as bool?) ?? false,
    messageSenderId: MessageSender.fromJson(
      tdMapFromJson(json['message_sender_id']),
    ),
    recentSpeakers: List<GroupCallRecentSpeaker>.from(
      tdListFromJson(json['recent_speakers'])
          .map((item) => GroupCallRecentSpeaker.fromJson(tdMapFromJson(item)))
          .whereType<GroupCallRecentSpeaker>(),
    ),
    isMyVideoEnabled: (json['is_my_video_enabled'] as bool?) ?? false,
    isMyVideoPaused: (json['is_my_video_paused'] as bool?) ?? false,
    canEnableVideo: (json['can_enable_video'] as bool?) ?? false,
    muteNewParticipants: (json['mute_new_participants'] as bool?) ?? false,
    canToggleMuteNewParticipants:
        (json['can_toggle_mute_new_participants'] as bool?) ?? false,
    canSendMessages: (json['can_send_messages'] as bool?) ?? false,
    areMessagesAllowed: (json['are_messages_allowed'] as bool?) ?? false,
    canToggleAreMessagesAllowed:
        (json['can_toggle_are_messages_allowed'] as bool?) ?? false,
    canDeleteMessages: (json['can_delete_messages'] as bool?) ?? false,
    recordDuration: (json['record_duration'] as int?) ?? 0,
    isVideoRecorded: (json['is_video_recorded'] as bool?) ?? false,
    duration: (json['duration'] as int?) ?? 0,
  );
}