BankConnectionsResourceBalance.fromJson constructor

BankConnectionsResourceBalance.fromJson(
  1. Object? json
)

Implementation

factory BankConnectionsResourceBalance.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return BankConnectionsResourceBalance(
    asOf: DateTime.fromMillisecondsSinceEpoch((map['as_of'] as int).toInt()),
    cash: map['cash'] == null
        ? null
        : BankConnectionsResourceBalanceApiResourceCashBalance.fromJson(
            map['cash']),
    credit: map['credit'] == null
        ? null
        : BankConnectionsResourceBalanceApiResourceCreditBalance.fromJson(
            map['credit']),
    current: (map['current'] as Map).cast<String, Object?>().map((
          key,
          value,
        ) =>
            MapEntry(
              key,
              (value as num).toInt(),
            )),
    type: BankConnectionsResourceBalanceType.fromJson(map['type']),
  );
}