DiscoverModule/lib/contacts_module/model_class/hcp_details.dart

100 lines
2.7 KiB
Dart
Raw Normal View History

2024-06-27 08:38:43 +00:00
// To parse this JSON data, do
//
// final table = tableFromJson(jsonString);
import 'dart:convert';
List<Table> tableFromJson(String str) =>
List<Table>.from(json.decode(str).map((x) => Table.fromJson(x)));
String tableToJson(List<Table> data) =>
json.encode(List<dynamic>.from(data.map((x) => x.toJson())));
class Table {
int id;
String name;
String email;
DateTime emailVerifiedAt;
String summarry;
String addr;
int licenseNo;
String pSuffix;
String speciality;
String subSpeciality;
int phoneNo;
int rank;
int score;
DateTime? createdAt;
DateTime? updatedAt;
int eventsCount;
int affiliationsCount;
int publicationsCount;
Table({
required this.id,
required this.name,
required this.email,
required this.emailVerifiedAt,
required this.summarry,
required this.addr,
required this.licenseNo,
required this.pSuffix,
required this.speciality,
required this.subSpeciality,
required this.phoneNo,
required this.rank,
required this.score,
required this.createdAt,
required this.updatedAt,
required this.eventsCount,
required this.affiliationsCount,
required this.publicationsCount,
});
factory Table.fromJson(Map<String, dynamic> json) => Table(
id: json["id"],
name: json["name"],
email: json["email"],
emailVerifiedAt: DateTime.parse(json["email_verified_at"]),
summarry: json["summarry"],
addr: json["addr"],
licenseNo: json["license_no"],
pSuffix: json["p_suffix"],
speciality: json["speciality"],
subSpeciality: json["sub_speciality"],
phoneNo: json["phone_no"],
rank: json["rank"],
score: json["score"],
createdAt: json["created_at"] == null
? null
: DateTime.parse(json["created_at"]),
updatedAt: json["updated_at"] == null
? null
: DateTime.parse(json["updated_at"]),
eventsCount: json["events_count"],
affiliationsCount: json["affiliations_count"],
publicationsCount: json["publications_count"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"email": email,
"email_verified_at": emailVerifiedAt.toIso8601String(),
"summarry": summarry,
"addr": addr,
"license_no": licenseNo,
"p_suffix": pSuffix,
"speciality": speciality,
"sub_speciality": subSpeciality,
"phone_no": phoneNo,
"rank": rank,
"score": score,
"created_at": createdAt?.toIso8601String(),
"updated_at": updatedAt?.toIso8601String(),
"events_count": eventsCount,
"affiliations_count": affiliationsCount,
"publications_count": publicationsCount,
};
}