User.fromJson constructor

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

Parses a User from TDLib JSON.

Implementation

factory User.fromJson(Map<String, dynamic> json) => User(
      id: _readInt(json['id']),
      firstName: _readString(json['first_name']),
      lastName: _readString(json['last_name']),
      usernames: _readOptional(json['usernames'], Usernames.fromJson),
      phoneNumber: _readString(json['phone_number']),
      status: _readObject(json['status'], UserStatus.fromJson),
      profilePhoto:
          _readOptional(json['profile_photo'], ProfilePhoto.fromJson),
      accentColorId: _readInt(json['accent_color_id']),
      backgroundCustomEmojiId: _readInt(json['background_custom_emoji_id']),
      profileAccentColorId: _readInt(json['profile_accent_color_id']),
      profileBackgroundCustomEmojiId:
          _readInt(json['profile_background_custom_emoji_id']),
      emojiStatus: _readOptional(json['emoji_status'], EmojiStatus.fromJson),
      isContact: _readBool(json['is_contact']),
      isMutualContact: _readBool(json['is_mutual_contact']),
      isCloseFriend: _readBool(json['is_close_friend']),
      isVerified: _readBool(json['is_verified']),
      isPremium: _readBool(json['is_premium']),
      isSupport: _readBool(json['is_support']),
      restrictionReason: _readString(json['restriction_reason']),
      isScam: _readBool(json['is_scam']),
      isFake: _readBool(json['is_fake']),
      hasActiveStories: _readBool(json['has_active_stories']),
      hasUnreadActiveStories: _readBool(json['has_unread_active_stories']),
      restrictsNewChats: _readBool(json['restricts_new_chats']),
      haveAccess: _readBool(json['have_access']),
      type: _readObject(json['type'], UserType.fromJson),
      languageCode: _readString(json['language_code']),
      addedToAttachmentMenu: _readBool(json['added_to_attachment_menu']),
      extra: json['@extra'],
      clientId: _readClientId(json['@client_id']),
    );