fromJson static method

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

Creates a object from a json

Implementation

static Chat fromJson(Map<String, dynamic> json) {
  return Chat(
    id: json['id']!,
    type: json['type']!,
    title: json['title'],
    username: json['username'],
    firstName: json['first_name'],
    lastName: json['last_name'],
    photo: callIfNotNull(ChatPhoto.fromJson, json['photo']),
    bio: json['bio'],
    hasPrivateForwards: json['has_private_forwards'],
    hasRestrictedVoiceAndVideoMessages:
        json['has_restricted_voice_and_video_messages'],
    joinToSendMessages: json['join_to_send_messages'],
    joinByRequest: json['join_by_request'],
    description: json['description'],
    inviteLink: json['invite_link'],
    pinnedMessage: callIfNotNull(Message.fromJson, json['pinned_message']),
    permissions: callIfNotNull(ChatPermissions.fromJson, json['permissions']),
    slowModeDelay: json['slow_mode_delay'],
    messageAutoDeleteTime: json['message_auto_delete_time'],
    hasProtectedContent: json['has_protected_content'],
    stickerSetName: json['sticker_set_name'],
    canSetStickerSet: json['can_set_sticker_set'],
    linkedChatId: json['linked_chat_id'],
    location: callIfNotNull(
      ChatLocation.fromJson,
      json['location'],
    ),
  );
}