// To parse this JSON data, do // // final quizPerQuestionResult = quizPerQuestionResultFromJson(jsonString); import 'dart:convert'; QuizPerQuestionResult quizPerQuestionResultFromJson(String str) => QuizPerQuestionResult.fromJson(json.decode(str)); String quizPerQuestionResultToJson(QuizPerQuestionResult data) => json.encode(data.toJson()); class QuizPerQuestionResult { int status; bool error; int total; List data; QuizPerQuestionResult({ required this.status, required this.error, required this.total, required this.data, }); factory QuizPerQuestionResult.fromJson(Map json) => QuizPerQuestionResult( status: json["status"], error: json["error"], total: json["total"], data: List.from(json["data"].map((x) => Datum.fromJson(x))), ); Map toJson() => { "status": status, "error": error, "total": total, "data": List.from(data.map((x) => x.toJson())), }; } class Datum { String id; String quizId; String title; String type; String numberOption; List options; List correctAnswers; String order; Datum({ required this.id, required this.quizId, required this.title, required this.type, required this.numberOption, required this.options, required this.correctAnswers, required this.order, }); factory Datum.fromJson(Map json) => Datum( id: json["id"], quizId: json["quiz_id"], title: json["title"], type: json["type"], numberOption: json["number_option"], options: List.from(json["options"].map((x) => x)), correctAnswers: List.from(json["correct_answers"].map((x) => x)), order: json["order"], ); Map toJson() => { "id": id, "quiz_id": quizId, "title": title, "type": type, "number_option": numberOption, "options": List.from(options.map((x) => x)), "correct_answers": List.from(correctAnswers.map((x) => x)), "order": order, }; }