CountrySpec.fromJson constructor

CountrySpec.fromJson(
  1. Object? json
)

Implementation

factory CountrySpec.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return CountrySpec(
    defaultCurrency: (map['default_currency'] as String),
    id: (map['id'] as String),
    supportedBankAccountCurrencies: (map['supported_bank_account_currencies']
            as Map)
        .cast<String, Object?>()
        .map((
          key,
          value,
        ) =>
            MapEntry(
              key,
              (value as List<Object?>).map((el) => (el as String)).toList(),
            )),
    supportedPaymentCurrencies:
        (map['supported_payment_currencies'] as List<Object?>)
            .map((el) => (el as String))
            .toList(),
    supportedPaymentMethods:
        (map['supported_payment_methods'] as List<Object?>)
            .map((el) => (el as String))
            .toList(),
    supportedTransferCountries:
        (map['supported_transfer_countries'] as List<Object?>)
            .map((el) => (el as String))
            .toList(),
    verificationFields:
        CountrySpecVerificationFields.fromJson(map['verification_fields']),
  );
}