import 'dart:convert'; UserProgressResponseModel userProgressResponseModelFromJson(String str) => UserProgressResponseModel.fromJson(json.decode(str)); String userProgressResponseModelToJson(UserProgressResponseModel data) => json.encode(data.toJson()); class UserProgressResponseModel { bool? isSuccess; int? statusCode; String? message; Data? data; dynamic errors; UserProgressResponseModel({ this.isSuccess, this.statusCode, this.message, this.data, this.errors, }); factory UserProgressResponseModel.fromJson(Map json) => UserProgressResponseModel( isSuccess: json["isSuccess"], statusCode: json["statusCode"], message: json["message"], data: json["data"] == null ? null : Data.fromJson(json["data"]), errors: json["errors"], ); Map toJson() => { "isSuccess": isSuccess, "statusCode": statusCode, "message": message, "data": data?.toJson(), "errors": errors, }; } class Data { List? challenges; List? goals; int? totalChallenges; int? totalGoals; Data({this.challenges, this.goals, this.totalChallenges, this.totalGoals}); factory Data.fromJson(Map json) => Data( challenges: json["challenges"] == null ? [] : List.from( json["challenges"]!.map((x) => ChallengePogress.fromJson(x)), ), goals: json["goals"] == null ? [] : List.from(json["goals"]!.map((x) => x)), totalChallenges: json["totalChallenges"], totalGoals: json["totalGoals"], ); Map toJson() => { "challenges": challenges == null ? [] : List.from(challenges!.map((x) => x.toJson())), "goals": goals == null ? [] : List.from(goals!.map((x) => x)), "totalChallenges": totalChallenges, "totalGoals": totalGoals, }; } class ChallengePogress { String? userId; int? challengeId; String? challengeTitle; String? status; String? taskUnit; double? totalMetricValue; ChallengePogress({ this.userId, this.challengeId, this.challengeTitle, this.status, this.taskUnit, this.totalMetricValue, }); factory ChallengePogress.fromJson(Map json) => ChallengePogress( userId: json["userID"], challengeId: json["challengeID"] is String ? int.tryParse(json["challengeID"]) : json["challengeID"], challengeTitle: json["challengeTitle"], status: json["status"], taskUnit: json["taskUnit"], totalMetricValue: json["totalMetricValue"] is int ? (json["totalMetricValue"] as int).toDouble() : json["totalMetricValue"]?.toDouble(), ); Map toJson() => { "userID": userId, "challengeID": challengeId, "challengeTitle": challengeTitle, "status": status, "taskUnit": taskUnit, "totalMetricValue": totalMetricValue, }; }