MailboxInfo.fromJson constructor
MailboxInfo.fromJson(
- Map<String, dynamic> json
)
Implementation
factory MailboxInfo.fromJson(Map<String, dynamic> json) {
final typeStr = json['type'] as String;
final type = MailboxType.values.firstWhere((e) => e.name == typeStr);
return MailboxInfo(
address: parseAddress(json['address'] as String, type: type),
messageCount: (json['messageCount'] as int?) ?? 0,
createdAt: DateTime.fromMillisecondsSinceEpoch((json['createdAt'] as int?) ?? 0),
lastAccessedAt: DateTime.fromMillisecondsSinceEpoch((json['lastAccessedAt'] as int?) ?? 0),
maxMessages: (json['maxMessages'] as int?) ?? 0,
retentionDays: (json['retentionDays'] as int?) ?? 0,
retentionCount: json['retentionCount'] as int?,
);
}