listFromJson static method
Die Pfandliste eines Artikels oder einer Gruppe; keine Liste -> null,
unlesbare Eintraege fallen weg. Eine leere Liste bleibt leer (= ausdruecklich
ohne Pfand).
Implementation
static List<DepositEntry>? listFromJson(Object? value) {
if (value is! List) return null;
final raus = <DepositEntry>[];
for (final e in value) {
if (e is! Map || e['depositTypeId'] is! String || (e['depositTypeId'] as String).isEmpty || !_istGanz(e['quantity'], 1)) continue;
raus.add(DepositEntry(
depositTypeId: e['depositTypeId'] as String,
quantity: _ganz(e['quantity'] as num),
gtin: e['gtin'] is String && (e['gtin'] as String).isNotEmpty ? e['gtin'] as String : null,
ownFilling: e['ownFilling'] is bool ? e['ownFilling'] as bool : null,
));
}
return raus;
}