toJson method
Die Zeile in der Form des Vertrags (expected/*.lines.json).
Implementation
Map<String, Object> toJson() => switch (this) {
LayoutTextLine(:final text, :final align, :final bold) => {'kind': 'text', 'text': text, 'align': align.name, 'bold': bold},
LayoutColumnsLine(:final columns) => {
'kind': 'columns',
'columns': [for (final c in columns) {'text': c.text, 'width': c.width, 'align': c.align.name}],
},
LayoutRuleLine(:final char) => {'kind': 'rule', 'char': char},
LayoutSpaceLine(:final lines) => {'kind': 'space', 'lines': lines},
LayoutQrLine(:final data) => {'kind': 'qr', 'data': data},
LayoutBannerLine(:final text, :final tone) => {'kind': 'banner', 'text': text, 'tone': tone.wire},
};