61 lines
1.7 KiB
Dart
61 lines
1.7 KiB
Dart
|
// To parse this JSON data, do
|
||
|
//
|
||
|
// final medicalInsight = medicalInsightFromJson(jsonString);
|
||
|
|
||
|
import 'dart:convert';
|
||
|
|
||
|
List<MedicalInsight> medicalInsightFromJson(String str) =>
|
||
|
List<MedicalInsight>.from(
|
||
|
json.decode(str).map((x) => MedicalInsight.fromJson(x)));
|
||
|
|
||
|
String medicalInsightToJson(List<MedicalInsight> data) =>
|
||
|
json.encode(List<dynamic>.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<String, dynamic> 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<String, dynamic> 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(),
|
||
|
};
|
||
|
}
|