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