TreasuryFinancialAccount.fromJson constructor

TreasuryFinancialAccount.fromJson(
  1. Object? json
)

Implementation

factory TreasuryFinancialAccount.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return TreasuryFinancialAccount(
    activeFeatures: map['active_features'] == null
        ? null
        : (map['active_features'] as List<Object?>)
            .map((el) =>
                TreasuryFinancialAccountActiveFeaturesItem.fromJson(el))
            .toList(),
    balance:
        TreasuryFinancialAccountsResourceBalance.fromJson(map['balance']),
    country: (map['country'] as String),
    created:
        DateTime.fromMillisecondsSinceEpoch((map['created'] as int).toInt()),
    features: map['features'] == null
        ? null
        : TreasuryFinancialAccountFeatures.fromJson(map['features']),
    financialAddresses: (map['financial_addresses'] as List<Object?>)
        .map((el) =>
            TreasuryFinancialAccountsResourceFinancialAddress.fromJson(el))
        .toList(),
    id: (map['id'] as String),
    livemode: (map['livemode'] as bool),
    metadata: map['metadata'] == null
        ? null
        : (map['metadata'] as Map).cast<String, Object?>().map((
              key,
              value,
            ) =>
                MapEntry(
                  key,
                  (value as String),
                )),
    pendingFeatures: map['pending_features'] == null
        ? null
        : (map['pending_features'] as List<Object?>)
            .map((el) =>
                TreasuryFinancialAccountActiveFeaturesItem.fromJson(el))
            .toList(),
    platformRestrictions: map['platform_restrictions'] == null
        ? null
        : TreasuryFinancialAccountPlatformRestrictions.fromJson(
            map['platform_restrictions']),
    restrictedFeatures: map['restricted_features'] == null
        ? null
        : (map['restricted_features'] as List<Object?>)
            .map((el) =>
                TreasuryFinancialAccountActiveFeaturesItem.fromJson(el))
            .toList(),
    status: TreasuryFinancialAccountStatus.fromJson(map['status']),
    statusDetails: TreasuryFinancialAccountsResourceStatusDetails.fromJson(
        map['status_details']),
    supportedCurrencies: (map['supported_currencies'] as List<Object?>)
        .map((el) => (el as String))
        .toList(),
  );
}