BankAccount.fromJson constructor

BankAccount.fromJson(
  1. Object? json
)

Implementation

factory BankAccount.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return BankAccount(
    account:
        map['account'] == null ? null : AccountOrId.fromJson(map['account']),
    accountHolderName: map['account_holder_name'] == null
        ? null
        : (map['account_holder_name'] as String),
    accountHolderType: map['account_holder_type'] == null
        ? null
        : (map['account_holder_type'] as String),
    accountType:
        map['account_type'] == null ? null : (map['account_type'] as String),
    availablePayoutMethods: map['available_payout_methods'] == null
        ? null
        : (map['available_payout_methods'] as List<Object?>)
            .map((el) => BankAccountAvailablePayoutMethodsItem.fromJson(el))
            .toList(),
    bankName: map['bank_name'] == null ? null : (map['bank_name'] as String),
    country: (map['country'] as String),
    currency: (map['currency'] as String),
    customer: map['customer'] == null
        ? null
        : BankAccountCustomerOrId.fromJson(map['customer']),
    defaultForCurrency: map['default_for_currency'] == null
        ? null
        : (map['default_for_currency'] as bool),
    fingerprint:
        map['fingerprint'] == null ? null : (map['fingerprint'] as String),
    futureRequirements: map['future_requirements'] == null
        ? null
        : BankAccountFutureRequirements.fromJson(map['future_requirements']),
    id: (map['id'] 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),
                )),
    requirements: map['requirements'] == null
        ? null
        : BankAccountFutureRequirements.fromJson(map['requirements']),
    routingNumber: map['routing_number'] == null
        ? null
        : (map['routing_number'] as String),
    status: (map['status'] as String),
  );
}