KonectarEvents/lib/contacts_module/model_class/email_model.dart

40 lines
868 B
Dart
Raw Normal View History

2024-10-08 12:01:59 +00:00
// To parse this JSON data, do
//
// final email = emailFromJson(jsonString);
import 'dart:convert';
List<Email> emailFromJson(String str) =>
List<Email>.from(json.decode(str).map((x) => Email.fromJson(x)));
String emailToJson(List<Email> data) =>
json.encode(List<dynamic>.from(data.map((x) => x.toJson())));
class Email {
int id;
int userId;
String emailType;
String email;
Email({
required this.id,
required this.userId,
required this.emailType,
required this.email,
});
factory Email.fromJson(Map<String, dynamic> json) => Email(
id: json["id"],
userId: json["user_id"],
emailType: json["Email Type"],
email: json["Email"],
);
Map<String, dynamic> toJson() => {
"id": id,
"user_id": userId,
"Email Type": emailType,
"Email": email,
};
}