CPDFHeaderFooter.fromJson constructor
CPDFHeaderFooter.fromJson(
- Map<String, dynamic> json
)
Implementation
factory CPDFHeaderFooter.fromJson(Map<String, dynamic> json) {
final rawMargin = json['margin'];
final margin = rawMargin is Map
? EdgeInsets.fromLTRB(
_asDouble(rawMargin['left'], 0),
_asDouble(rawMargin['top'], 0),
_asDouble(rawMargin['right'], 0),
_asDouble(rawMargin['bottom'], 0),
)
: EdgeInsets.zero;
final rawSlots = json['slots'];
return CPDFHeaderFooter(
pages: _pagesFromString(json['pages'] as String? ?? ''),
margin: margin,
slots: rawSlots is List
? rawSlots
.whereType<Map>()
.map(
(slot) => CPDFHeaderFooterSlot.fromJson(
Map<String, dynamic>.from(slot),
),
)
.toList()
: const <CPDFHeaderFooterSlot>[],
);
}