KonectarEvents/lib/contacts_module/model_class/speaker.dart

56 lines
1.5 KiB
Dart

// To parse this JSON data, do
//
// final speaker = speakerFromJson(jsonString);
import 'dart:convert';
List<Speaker> speakerFromJson(String str) =>
List<Speaker>.from(json.decode(str).map((x) => Speaker.fromJson(x)));
String speakerToJson(List<Speaker> data) =>
json.encode(List<dynamic>.from(data.map((x) => x.toJson())));
class Speaker {
int id;
String programtopic;
String speakername;
String role;
String evaluatorname;
String programdate;
DateTime createdAt;
DateTime updatedAt;
Speaker({
required this.id,
required this.programtopic,
required this.speakername,
required this.role,
required this.evaluatorname,
required this.programdate,
required this.createdAt,
required this.updatedAt,
});
factory Speaker.fromJson(Map<String, dynamic> json) => Speaker(
id: json["id"],
programtopic: json["programtopic"],
speakername: json["speakername"],
role: json["role"],
evaluatorname: json["evaluatorname"],
programdate: json["programdate"],
createdAt: DateTime.parse(json["created_at"]),
updatedAt: DateTime.parse(json["updated_at"]),
);
Map<String, dynamic> toJson() => {
"id": id,
"programtopic": programtopic,
"speakername": speakername,
"role": role,
"evaluatorname": evaluatorname,
"programdate": programdate,
"created_at": createdAt.toIso8601String(),
"updated_at": updatedAt.toIso8601String(),
};
}