// To parse this JSON data, do // // final quizQuestion = quizQuestionFromJson(jsonString); import 'dart:convert'; QuizQuestion quizQuestionFromJson(String str) => QuizQuestion.fromJson(json.decode(str)); String quizQuestionToJson(QuizQuestion data) => json.encode(data.toJson()); class QuizQuestion { final List data; QuizQuestion({ required this.data, }); factory QuizQuestion.fromJson(Map json) => QuizQuestion( data: List.from(json["data"].map((x) => Datum.fromJson(x))), ); Map toJson() => { "data": List.from(data.map((x) => x.toJson())), }; } class Datum { final String id; final String quizId; final String title; final String type; final String numberOption; final List options; final List correctAnswers; final 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, }; }