UserProfileModel.fromJson constructor

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

Implementation

factory UserProfileModel.fromJson(Map<String, dynamic> json) {
  return UserProfileModel(
    id: json['id'] as int?,
    userId: json['user_id'] as String?,
    gender: json['gender'] as String?,
    heightCm: json['height_cm'] as int?,
    weightKg: (json['weight_kg'] as num?)?.toDouble(),
    bustCm: json['bust_cm'] as int?,
    waistCm: json['waist_cm'] as int?,
    hipsCm: json['hips_cm'] as int?,
    fitPreference: json['fit_preference'] as String?,
    stylePreferenceTags: json['style_preference_tags'] != null
        ? List<String>.from(json['style_preference_tags'] as List)
        : null,
    colorPreferenceTags: json['color_preference_tags'] != null
        ? List<String>.from(json['color_preference_tags'] as List)
        : null,
    avoidElements: json['avoid_elements'] as String?,
    userProfileData: json['user_profile_data'] as Map<String, dynamic>?,
    sceneTag: json['scene_tag'] as String?,
    bmi: (json['bmi'] as num?)?.toDouble(),
    waistHipRatio: (json['waist_hip_ratio'] as num?)?.toDouble(),
    createdAt: json['created_at'] as String?,
    updatedAt: json['updated_at'] as String?,
  );
}