40 lines
868 B
Dart
40 lines
868 B
Dart
|
// 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,
|
||
|
};
|
||
|
}
|