// To parse this JSON data, do // // final speaker = speakerFromJson(jsonString); import 'dart:convert'; List speakerFromJson(String str) => List.from(json.decode(str).map((x) => Speaker.fromJson(x))); String speakerToJson(List data) => json.encode(List.from(data.map((x) => x.toJson()))); class Speaker { int id; String programtopic; String speakername; String role; String evaluatorname; String programdate; DateTime createdAt; DateTime updatedAt; Speaker({ required this.id, required this.programtopic, required this.speakername, required this.role, required this.evaluatorname, required this.programdate, required this.createdAt, required this.updatedAt, }); factory Speaker.fromJson(Map json) => Speaker( id: json["id"], programtopic: json["programtopic"], speakername: json["speakername"], role: json["role"], evaluatorname: json["evaluatorname"], programdate: json["programdate"], createdAt: DateTime.parse(json["created_at"]), updatedAt: DateTime.parse(json["updated_at"]), ); Map toJson() => { "id": id, "programtopic": programtopic, "speakername": speakername, "role": role, "evaluatorname": evaluatorname, "programdate": programdate, "created_at": createdAt.toIso8601String(), "updated_at": updatedAt.toIso8601String(), }; }