toJson method

Map<String, dynamic> toJson()

Convert this object into a JSON object.

Implementation

Map<String, dynamic> toJson() {
  final Location? lastLogin = lastLoginLocation;
  final OidcData? oidcStruct = oidcData;

  return <String, dynamic>{
    'activities': activities,
    'address': address,
    'age': age,
    'bio': bio,
    'birthDay': birthDay,
    'birthMonth': birthMonth,
    'birthYear': birthYear,
    if (certifications.isNotEmpty)
      'certifications':
          certifications.map((Certification c) => c.toJson()).toList(),
    'city': city,
    'country': country,
    if (education.isNotEmpty)
      'education': education.map((Education e) => e.toJson()).toList(),
    'educationLevel': educationLevel,
    'email': email,
    if (favorites.isNotEmpty)
      'favorites': favorites.map((Favorite f) => f.toJson()).toList(),
    'firstName': firstName,
    'followersCounts': followers,
    'followingCount': following,
    'gender': gender,
    'hometown': hometown,
    'honors': honors,
    'industry': industry,
    'interests': interests,
    'languages': languages,
    if (lastLogin != null) 'lastLoginLocation': lastLogin.toJson(),
    'lastName': lastName,
    if (likes.isNotEmpty) 'likes': likes.map((Like l) => l.toJson()).toList(),
    'locale': locale,
    'name': name,
    'nickname': nickname,
    if (oidcStruct != null) 'oidcData': oidcStruct.toJson(),
    if (patents.isNotEmpty)
      'patents': patents.map((Patent p) => p.toJson()).toList(),
    if (phones.isNotEmpty)
      'phones': phones.map((Phone p) => p.toJson()).toList(),
    'photoURL': photoUrl,
    'politicalView': politicalView,
    'professionalHeadline': professionalHeadline,
    'profileURL': profileUrl,
    'proxyEmail': proxyEmail,
    if (publications.isNotEmpty)
      'publications':
          publications.map((Publication p) => p.toJson()).toList(),
    'relationshipStatus': relationshipStatus,
    'religion': religion,
    if (skills.isNotEmpty)
      'skills': skills.map((Skill s) => s.toJson()).toList(),
    'specialities': specialities,
    'state': state,
    'thumbnailURL': thumbnailUrl,
    'timezone': timezone,
    'username': username,
    'verified': verified,
    if (work.isNotEmpty) 'work': work.map((Work w) => w.toJson()).toList(),
    'zip': zip,
  };
}