Card.fromJson constructor

Card.fromJson(
  1. Object? json
)

Implementation

factory Card.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return Card(
    account:
        map['account'] == null ? null : AccountOrId.fromJson(map['account']),
    addressCity:
        map['address_city'] == null ? null : (map['address_city'] as String),
    addressCountry: map['address_country'] == null
        ? null
        : (map['address_country'] as String),
    addressLine1: map['address_line1'] == null
        ? null
        : (map['address_line1'] as String),
    addressLine1Check: map['address_line1_check'] == null
        ? null
        : (map['address_line1_check'] as String),
    addressLine2: map['address_line2'] == null
        ? null
        : (map['address_line2'] as String),
    addressState: map['address_state'] == null
        ? null
        : (map['address_state'] as String),
    addressZip:
        map['address_zip'] == null ? null : (map['address_zip'] as String),
    addressZipCheck: map['address_zip_check'] == null
        ? null
        : (map['address_zip_check'] as String),
    availablePayoutMethods: map['available_payout_methods'] == null
        ? null
        : (map['available_payout_methods'] as List<Object?>)
            .map((el) => BankAccountAvailablePayoutMethodsItem.fromJson(el))
            .toList(),
    brand: (map['brand'] as String),
    country: map['country'] == null ? null : (map['country'] as String),
    currency: map['currency'] == null ? null : (map['currency'] as String),
    customer: map['customer'] == null
        ? null
        : BankAccountCustomerOrId.fromJson(map['customer']),
    cvcCheck: map['cvc_check'] == null ? null : (map['cvc_check'] as String),
    defaultForCurrency: map['default_for_currency'] == null
        ? null
        : (map['default_for_currency'] as bool),
    description:
        map['description'] == null ? null : (map['description'] as String),
    dynamicLast4: map['dynamic_last4'] == null
        ? null
        : (map['dynamic_last4'] as String),
    expMonth: (map['exp_month'] as num).toInt(),
    expYear: (map['exp_year'] as num).toInt(),
    fingerprint:
        map['fingerprint'] == null ? null : (map['fingerprint'] as String),
    funding: (map['funding'] as String),
    id: (map['id'] as String),
    iin: map['iin'] == null ? null : (map['iin'] as String),
    issuer: map['issuer'] == null ? null : (map['issuer'] as String),
    last4: (map['last4'] as String),
    metadata: map['metadata'] == null
        ? null
        : (map['metadata'] as Map).cast<String, Object?>().map((
              key,
              value,
            ) =>
                MapEntry(
                  key,
                  (value as String),
                )),
    name: map['name'] == null ? null : (map['name'] as String),
    networks: map['networks'] == null
        ? null
        : TokenCardNetworks.fromJson(map['networks']),
    status: map['status'] == null ? null : (map['status'] as String),
    tokenizationMethod: map['tokenization_method'] == null
        ? null
        : (map['tokenization_method'] as String),
  );
}