toJson method

Map<String, dynamic> toJson()

Serializes the unwrapped template model to JSON.

Implementation

Map<String, dynamic> toJson() => {
  'schemaVersion': 7,
  'name': name,
  'locale': locale,
  'currency': currency,
  if (variables.isNotEmpty) 'variables': variables,
  if (fonts.isNotEmpty) 'fonts': fonts.map((font) => font.toJson()).toList(),
  'page': {
    'format': paperSize.label,
    'orientation': orientation.name,
    'width': pageWidth,
    'height': pageHeight,
    'unit': 'pt',
    'headerHeight': headerHeight,
    'footerHeight': footerHeight,
  },
  'elements': elements.map((element) => element.toJson()).toList(),
};