Contact.fromJson constructor

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

Implementation

factory Contact.fromJson(Map<String, dynamic> json) => Contact(
      id: (json['id'] as String?) ?? '',
      displayName: (json['displayName'] as String?) ?? '',
      thumbnail: json['thumbnail'] as Uint8List?,
      photo: json['photo'] as Uint8List?,
      isStarred: (json['isStarred'] as bool?) ?? false,
      name: Name.fromJson(Map<String, dynamic>.from(json['name'] ?? {})),
      phones: ((json['phones'] as List?) ?? [])
          .map((x) => Phone.fromJson(Map<String, dynamic>.from(x)))
          .toList(),
      emails: ((json['emails'] as List?) ?? [])
          .map((x) => Email.fromJson(Map<String, dynamic>.from(x)))
          .toList(),
      addresses: ((json['addresses'] as List?) ?? [])
          .map((x) => Address.fromJson(Map<String, dynamic>.from(x)))
          .toList(),
      organizations: ((json['organizations'] as List?) ?? [])
          .map((x) => Organization.fromJson(Map<String, dynamic>.from(x)))
          .toList(),
      websites: ((json['websites'] as List?) ?? [])
          .map((x) => Website.fromJson(Map<String, dynamic>.from(x)))
          .toList(),
      socialMedias: ((json['socialMedias'] as List?) ?? [])
          .map((x) => SocialMedia.fromJson(Map<String, dynamic>.from(x)))
          .toList(),
      events: ((json['events'] as List?) ?? [])
          .map((x) => Event.fromJson(Map<String, dynamic>.from(x)))
          .toList(),
      notes: ((json['notes'] as List?) ?? [])
          .map((x) => Note.fromJson(Map<String, dynamic>.from(x)))
          .toList(),
      accounts: ((json['accounts'] as List?) ?? [])
          .map((x) => Account.fromJson(Map<String, dynamic>.from(x)))
          .toList(),
      groups: ((json['groups'] as List?) ?? [])
          .map((x) => Group.fromJson(Map<String, dynamic>.from(x)))
          .toList(),
    );