KonectarEvents/lib/model/specialtymodel.dart

68 lines
1.8 KiB
Dart
Raw Permalink Normal View History

2024-09-06 06:30:31 +00:00
// To parse this JSON data, do
//
// final specialtyData = specialtyDataFromJson(jsonString);
import 'dart:convert';
SpecialtyData specialtyDataFromJson(String str) =>
SpecialtyData.fromJson(json.decode(str));
String specialtyDataToJson(SpecialtyData data) => json.encode(data.toJson());
class SpecialtyData {
2024-10-07 12:45:45 +00:00
List<Map<String, List<Specialty>>> data;
2024-09-06 06:30:31 +00:00
SpecialtyData({
required this.data,
});
factory SpecialtyData.fromJson(Map<String, dynamic> json) => SpecialtyData(
2024-10-07 12:45:45 +00:00
data: List<Map<String, List<Specialty>>>.from(json["data"].map((x) =>
Map.from(x).map((k, v) => MapEntry<String, List<Specialty>>(k,
List<Specialty>.from(v.map((x) => Specialty.fromJson(x))))))),
2024-09-06 06:30:31 +00:00
);
Map<String, dynamic> toJson() => {
"data": List<dynamic>.from(data.map((x) => Map.from(x).map((k, v) =>
MapEntry<String, dynamic>(
k, List<dynamic>.from(v.map((x) => x.toJson())))))),
};
}
2024-10-07 12:45:45 +00:00
class Specialtyresp {
List<Specialty> data;
Specialtyresp({
required this.data,
});
factory Specialtyresp.fromJson(Map<String, dynamic> json) => Specialtyresp(
data: List<Specialty>.from(
json["data"].map((x) => Specialty.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"data": List<dynamic>.from(data.map((x) => x.toJson())),
};
}
class Specialty {
2024-09-06 06:30:31 +00:00
String specialtyCount;
String specialtyName;
2024-10-07 12:45:45 +00:00
Specialty({
2024-09-06 06:30:31 +00:00
required this.specialtyCount,
required this.specialtyName,
});
2024-10-07 12:45:45 +00:00
factory Specialty.fromJson(Map<String, dynamic> json) => Specialty(
2024-09-06 06:30:31 +00:00
specialtyCount: json["specialty_count"],
specialtyName: json["specialty_name"],
);
Map<String, dynamic> toJson() => {
"specialty_count": specialtyCount,
"specialty_name": specialtyName,
};
}