DiscoverModule/lib/model_class/trials.dart

68 lines
1.6 KiB
Dart

// To parse this JSON data, do
//
// final trials = trialsFromJson(jsonString);
import 'dart:convert';
List<Trials> trialsFromJson(String str) =>
List<Trials>.from(json.decode(str).map((x) => Trials.fromJson(x)));
String trialsToJson(List<Trials> data) =>
json.encode(List<dynamic>.from(data.map((x) => x.toJson())));
class Trials {
int id;
int userId;
String ctId;
String trialName;
String status;
String sponsors;
String condition;
String intervention;
String phase;
dynamic createdAt;
dynamic updatedAt;
Trials({
required this.id,
required this.userId,
required this.ctId,
required this.trialName,
required this.status,
required this.sponsors,
required this.condition,
required this.intervention,
required this.phase,
required this.createdAt,
required this.updatedAt,
});
factory Trials.fromJson(Map<String, dynamic> json) => Trials(
id: json["id"],
userId: json["user_id"],
ctId: json["ct_id"],
trialName: json["trial_name"],
status: json["status"],
sponsors: json["sponsors"],
condition: json["condition"],
intervention: json["intervention"],
phase: json["phase"],
createdAt: json["created_at"],
updatedAt: json["updated_at"],
);
Map<String, dynamic> toJson() => {
"id": id,
"user_id": userId,
"ct_id": ctId,
"trial_name": trialName,
"status": status,
"sponsors": sponsors,
"condition": condition,
"intervention": intervention,
"phase": phase,
"created_at": createdAt,
"updated_at": updatedAt,
};
}