fromJson static method

CollectibleItemInfo? fromJson(
  1. Map<String, dynamic>? json
)

Implementation

static CollectibleItemInfo? fromJson(Map<String, dynamic>? json) {
  if (json == null) {
    return null;
  }

  return CollectibleItemInfo(
    purchaseDate: (json['purchase_date'] as int?) ?? 0,
    currency: (json['currency'] as String?) ?? '',
    amount: (json['amount'] as int?) ?? 0,
    cryptocurrency: (json['cryptocurrency'] as String?) ?? '',
    cryptocurrencyAmount:
        int.tryParse(
          (json['cryptocurrency_amount'] as dynamic)?.toString() ?? '',
        ) ??
        0,
    url: (json['url'] as String?) ?? '',
  );
}