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']),
  upgradedGiftColors: _readOptional(
    json['upgraded_gift_colors'],
    UpgradedGiftColors.fromJson,
  ),
  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']),
  verificationStatus: _readOptional(
    json['verification_status'],
    VerificationStatus.fromJson,
  ),
  isPremium: _readBool(json['is_premium']),
  isSupport: _readBool(json['is_support']),
  restrictionInfo: _readOptional(
    json['restriction_info'],
    RestrictionInfo.fromJson,
  ),
  activeStoryState: _readOptional(
    json['active_story_state'],
    ActiveStoryState.fromJson,
  ),
  restrictsNewChats: _readBool(json['restricts_new_chats']),
  paidMessageStarCount: _readInt(json['paid_message_star_count']),
  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']),
);