Balance.fromJson constructor

Balance.fromJson(
  1. Object? json
)

Implementation

factory Balance.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return Balance(
    available: (map['available'] as List<Object?>)
        .map((el) => BalanceAmount.fromJson(el))
        .toList(),
    connectReserved: map['connect_reserved'] == null
        ? null
        : (map['connect_reserved'] as List<Object?>)
            .map((el) => BalanceAmount.fromJson(el))
            .toList(),
    instantAvailable: map['instant_available'] == null
        ? null
        : (map['instant_available'] as List<Object?>)
            .map((el) => BalanceAmountNet.fromJson(el))
            .toList(),
    issuing: map['issuing'] == null
        ? null
        : BalanceDetail.fromJson(map['issuing']),
    livemode: (map['livemode'] as bool),
    pending: (map['pending'] as List<Object?>)
        .map((el) => BalanceAmount.fromJson(el))
        .toList(),
  );
}