fromMap static method

User? fromMap(
  1. Map<String, dynamic>? _map
)
override

Construct from Map.

Implementation

static User? fromMap(Map<String, dynamic>? _map) {
  if (_map == null) return null;
  var _ = _map["@type"];
  if (_ != CONSTRUCTOR) return null;
  var extra = _map['@extra'];
  var clientId = _map['@clientId'];
  var id = _map['id']! as int;
  var first_name = _map['first_name']! as String;
  var last_name = _map['last_name']! as String;
  var usernames = Usernames.fromMap(_map['usernames']);
  var phone_number = _map['phone_number']! as String;
  var status = UserStatus.fromMap(_map['status'])!;
  var profile_photo = ProfilePhoto.fromMap(_map['profile_photo']);
  var emoji_status = EmojiStatus.fromMap(_map['emoji_status']);
  var is_contact = _map['is_contact']! as bool;
  var is_mutual_contact = _map['is_mutual_contact']! as bool;
  var is_close_friend = _map['is_close_friend']! as bool;
  var is_verified = _map['is_verified']! as bool;
  var is_premium = _map['is_premium']! as bool;
  var is_support = _map['is_support']! as bool;
  var restriction_reason = _map['restriction_reason']! as String;
  var is_scam = _map['is_scam']! as bool;
  var is_fake = _map['is_fake']! as bool;
  var has_active_stories = _map['has_active_stories']! as bool;
  var has_unread_active_stories = _map['has_unread_active_stories']! as bool;
  var have_access = _map['have_access']! as bool;
  var type = UserType.fromMap(_map['type'])!;
  var language_code = _map['language_code']! as String;
  var added_to_attachment_menu = _map['added_to_attachment_menu']! as bool;
  return User(
    extra: extra,
    clientId: clientId,
    id: id,
    first_name: first_name,
    last_name: last_name,
    usernames: usernames,
    phone_number: phone_number,
    status: status,
    profile_photo: profile_photo,
    emoji_status: emoji_status,
    is_contact: is_contact,
    is_mutual_contact: is_mutual_contact,
    is_close_friend: is_close_friend,
    is_verified: is_verified,
    is_premium: is_premium,
    is_support: is_support,
    restriction_reason: restriction_reason,
    is_scam: is_scam,
    is_fake: is_fake,
    has_active_stories: has_active_stories,
    has_unread_active_stories: has_unread_active_stories,
    have_access: have_access,
    type: type,
    language_code: language_code,
    added_to_attachment_menu: added_to_attachment_menu,
  );
}