fromJson static method

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

Implementation

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

  return ChatStatisticsChannel(
    period: DateRange.fromJson(tdMapFromJson(json['period'])),
    memberCount: StatisticalValue.fromJson(
      tdMapFromJson(json['member_count']),
    ),
    meanMessageViewCount: StatisticalValue.fromJson(
      tdMapFromJson(json['mean_message_view_count']),
    ),
    meanMessageShareCount: StatisticalValue.fromJson(
      tdMapFromJson(json['mean_message_share_count']),
    ),
    meanMessageReactionCount: StatisticalValue.fromJson(
      tdMapFromJson(json['mean_message_reaction_count']),
    ),
    meanStoryViewCount: StatisticalValue.fromJson(
      tdMapFromJson(json['mean_story_view_count']),
    ),
    meanStoryShareCount: StatisticalValue.fromJson(
      tdMapFromJson(json['mean_story_share_count']),
    ),
    meanStoryReactionCount: StatisticalValue.fromJson(
      tdMapFromJson(json['mean_story_reaction_count']),
    ),
    enabledNotificationsPercentage:
        ((json['enabled_notifications_percentage'] as num?) ?? 0.0)
            .toDouble(),
    memberCountGraph: StatisticalGraph.fromJson(
      tdMapFromJson(json['member_count_graph']),
    ),
    joinGraph: StatisticalGraph.fromJson(tdMapFromJson(json['join_graph'])),
    muteGraph: StatisticalGraph.fromJson(tdMapFromJson(json['mute_graph'])),
    viewCountByHourGraph: StatisticalGraph.fromJson(
      tdMapFromJson(json['view_count_by_hour_graph']),
    ),
    viewCountBySourceGraph: StatisticalGraph.fromJson(
      tdMapFromJson(json['view_count_by_source_graph']),
    ),
    joinBySourceGraph: StatisticalGraph.fromJson(
      tdMapFromJson(json['join_by_source_graph']),
    ),
    languageGraph: StatisticalGraph.fromJson(
      tdMapFromJson(json['language_graph']),
    ),
    messageInteractionGraph: StatisticalGraph.fromJson(
      tdMapFromJson(json['message_interaction_graph']),
    ),
    messageReactionGraph: StatisticalGraph.fromJson(
      tdMapFromJson(json['message_reaction_graph']),
    ),
    storyInteractionGraph: StatisticalGraph.fromJson(
      tdMapFromJson(json['story_interaction_graph']),
    ),
    storyReactionGraph: StatisticalGraph.fromJson(
      tdMapFromJson(json['story_reaction_graph']),
    ),
    instantViewInteractionGraph: StatisticalGraph.fromJson(
      tdMapFromJson(json['instant_view_interaction_graph']),
    ),
    recentInteractions: List<ChatStatisticsInteractionInfo>.from(
      tdListFromJson(json['recent_interactions'])
          .map(
            (item) =>
                ChatStatisticsInteractionInfo.fromJson(tdMapFromJson(item)),
          )
          .whereType<ChatStatisticsInteractionInfo>(),
    ),
  );
}