UserProfile.fromJson constructor
UserProfile.fromJson(
- Map<String, dynamic> json
)
Implementation
factory UserProfile.fromJson(Map<String, dynamic> json) {
return UserProfile(
id: json['id'] as int,
profileId: json['profileId'] as int,
garminGuid: json['garminGUID'] as String,
displayName: json['displayName'] as String,
fullName: json['fullName'] as String,
userName: json['userName'] as String,
profileImageType: json['profileImageType']?.toString(),
profileImageUrlLarge: json['profileImageUrlLarge']?.toString(),
profileImageUrlMedium: json['profileImageUrlMedium']?.toString(),
profileImageUrlSmall: json['profileImageUrlSmall']?.toString(),
location: json['location']?.toString(),
facebookUrl: json['facebookUrl']?.toString(),
twitterUrl: json['twitterUrl']?.toString(),
personalWebsite: json['personalWebsite']?.toString(),
motivation: json['motivation']?.toString(),
bio: json['bio']?.toString(),
primaryActivity: json['primaryActivity']?.toString(),
favoriteActivityTypes: List<String>.from(
json['favoriteActivityTypes'] ?? [],
),
runningTrainingSpeed: (json['runningTrainingSpeed'] as num).toDouble(),
cyclingTrainingSpeed: (json['cyclingTrainingSpeed'] as num).toDouble(),
favoriteCyclingActivityTypes: List<String>.from(
json['favoriteCyclingActivityTypes'] ?? [],
),
cyclingClassification: json['cyclingClassification']?.toString(),
cyclingMaxAvgPower: (json['cyclingMaxAvgPower'] as num).toDouble(),
swimmingTrainingSpeed: (json['swimmingTrainingSpeed'] as num).toDouble(),
profileVisibility: json['profileVisibility'] as String,
activityStartVisibility: json['activityStartVisibility'] as String,
activityMapVisibility: json['activityMapVisibility'] as String,
courseVisibility: json['courseVisibility'] as String,
activityHeartRateVisibility:
json['activityHeartRateVisibility'] as String,
activityPowerVisibility: json['activityPowerVisibility'] as String,
badgeVisibility: json['badgeVisibility'] as String,
showAge: json['showAge'] as bool,
showWeight: json['showWeight'] as bool,
showHeight: json['showHeight'] as bool,
showWeightClass: json['showWeightClass'] as bool,
showAgeRange: json['showAgeRange'] as bool,
showGender: json['showGender'] as bool,
showActivityClass: json['showActivityClass'] as bool,
showVo2Max: json['showVO2Max'] as bool,
showPersonalRecords: json['showPersonalRecords'] as bool,
showLast12Months: json['showLast12Months'] as bool,
showLifetimeTotals: json['showLifetimeTotals'] as bool,
showUpcomingEvents: json['showUpcomingEvents'] as bool,
showRecentFavorites: json['showRecentFavorites'] as bool,
showRecentDevice: json['showRecentDevice'] as bool,
showRecentGear: json['showRecentGear'] as bool,
showBadges: json['showBadges'] as bool,
otherActivity: json['otherActivity']?.toString(),
otherPrimaryActivity: json['otherPrimaryActivity']?.toString(),
otherMotivation: json['otherMotivation']?.toString(),
userRoles: List<String>.from(json['userRoles'] ?? []),
nameApproved: json['nameApproved'] as bool,
userProfileFullName: json['userProfileFullName'] as String,
makeGolfScorecardsPrivate: json['makeGolfScorecardsPrivate'] as bool,
allowGolfLiveScoring: json['allowGolfLiveScoring'] as bool,
allowGolfScoringByConnections:
json['allowGolfScoringByConnections'] as bool,
userLevel: json['userLevel'] as int,
userPoint: json['userPoint'] as int,
levelUpdateDate: json['levelUpdateDate'] as String,
levelIsViewed: json['levelIsViewed'] as bool,
levelPointThreshold: json['levelPointThreshold'] as int,
userPointOffset: json['userPointOffset'] as int,
userPro: json['userPro'] as bool,
);
}