// To parse this JSON data, do // // final medicalInsight = medicalInsightFromJson(jsonString); import 'dart:convert'; List medicalInsightFromJson(String str) => List.from( json.decode(str).map((x) => MedicalInsight.fromJson(x))); String medicalInsightToJson(List data) => json.encode(List.from(data.map((x) => x.toJson()))); class MedicalInsight { int id; int interactionId; String therapeuticArea; String product; String sourceType; String topics; String hcpName; DateTime createdAt; DateTime updatedAt; MedicalInsight({ required this.id, required this.interactionId, required this.therapeuticArea, required this.product, required this.sourceType, required this.topics, required this.hcpName, required this.createdAt, required this.updatedAt, }); factory MedicalInsight.fromJson(Map json) => MedicalInsight( id: json["id"], interactionId: json["Interaction Id"], therapeuticArea: json["Therapeutic Area"], product: json["Product"], sourceType: json["Source Type"], topics: json["Topics"], hcpName: json["HCP Name"], createdAt: DateTime.parse(json["created_at"]), updatedAt: DateTime.parse(json["updated_at"]), ); Map toJson() => { "id": id, "Interaction Id": interactionId, "Therapeutic Area": therapeuticArea, "Product": product, "Source Type": sourceType, "Topics": topics, "HCP Name": hcpName, "created_at": createdAt.toIso8601String(), "updated_at": updatedAt.toIso8601String(), }; }