KonectarApp/lib/model/specialtymodel.dart

51 lines
1.4 KiB
Dart

// 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 {
List<Map<String, List<Datum>>> data;
SpecialtyData({
required this.data,
});
factory SpecialtyData.fromJson(Map<String, dynamic> json) => SpecialtyData(
data: List<Map<String, List<Datum>>>.from(json["data"].map((x) =>
Map.from(x).map((k, v) => MapEntry<String, List<Datum>>(
k, List<Datum>.from(v.map((x) => Datum.fromJson(x))))))),
);
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())))))),
};
}
class Datum {
String specialtyCount;
String specialtyName;
Datum({
required this.specialtyCount,
required this.specialtyName,
});
factory Datum.fromJson(Map<String, dynamic> json) => Datum(
specialtyCount: json["specialty_count"],
specialtyName: json["specialty_name"],
);
Map<String, dynamic> toJson() => {
"specialty_count": specialtyCount,
"specialty_name": specialtyName,
};
}