update struct

This commit is contained in:
Juan Marulanda De Los Rios 2025-08-11 17:35:39 -04:00
parent 1c6d3d6920
commit b8987e6a8d

View File

@ -11,6 +11,7 @@ class GetThreadResponse {
final String from_name;
final String from_address;
final List<MailAddress> to;
final bool seen;
GetThreadResponse({
required this.id,
@ -20,19 +21,20 @@ class GetThreadResponse {
required this.from_name,
required this.from_address,
required this.to,
required this.seen,
});
factory GetThreadResponse.fromJson(Map<String, dynamic> json) {
var toList = json['to'] as List<dynamic>;
return GetThreadResponse(
id: json['id'],
messages: List<String>.from(json['messages']),
subject: json['subject'],
date: DateTime.parse(json['date']),
from_name: json['from_name'],
from_address: json['from_address'],
to: toList.map((i) => MailAddress.fromJson(i)).toList(),
);
id: json['id'],
messages: List<String>.from(json['messages']),
subject: json['subject'],
date: DateTime.parse(json['date']),
from_name: json['from_name'],
from_address: json['from_address'],
to: toList.map((i) => MailAddress.fromJson(i)).toList(),
seen: json['seen']);
}
}