fromJson static method
Implementation
static ReceiptLayout? fromJson(dynamic json) {
if (json is! Map) return null;
final roh = json['lines'];
if (roh is! List) return null;
final lines = <LayoutLine>[];
for (final z in roh) {
if (z is Map) {
final zeile = LayoutLine.fromJson(Map<String, dynamic>.from(z));
if (zeile != null) lines.add(zeile);
}
}
return ReceiptLayout(
lines: lines,
// Ohne Angabe 80 mm: das Server-Layout hat immer diese Breite.
paperSize: (json['paperSize'] ?? 'mm80').toString(),
ruleset: (json['ruleset'] is num) ? (json['ruleset'] as num).toInt() : 1,
);
}