ReaderCart.fromJson constructor

ReaderCart.fromJson(
  1. Object? json
)

Implementation

factory ReaderCart.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return ReaderCart(
    currency: (map['currency'] as String),
    lineItems: (map['line_items'] as List<Object?>)
        .map((el) => TerminalReaderReaderResourceLineItem.fromJson(el))
        .toList(),
    tax: map['tax'] == null ? null : (map['tax'] as num).toInt(),
    total: (map['total'] as num).toInt(),
  );
}