I made a model in which I go to get the various data, they are all ok except the 'card' in which I cannot save the data to its inside in my Model.. how can I save the data inside the 'card' of the Map you see in the picture?
factory VoucherPdf.fromJson(Map<String, dynamic> json) {
try {
return VoucherPdf._(
id: json.get('id') as int,
orderId: json.get('order_id') as int,
quoteId: json.get('quote_id') as int,
createdAt: json['createdAt'] == null
? null
: DateTime.parse(json.get('createdAt') as String),
status: json.get('status') as int,
card: json.get('card') as Map<String, dynamic>,
);
} catch (e) {
logger.e('[VoucherPdf-fromJson] Deserializing error: ${e.oneline}');
rethrow;
}
}
Since card is a map, read the pdf like index?.card['pdf']
and not index?.card.pdf
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.