Transfer.fromJson constructor
Transfer.fromJson(
- Object? json
Implementation
factory Transfer.fromJson(Object? json) {
final map = (json as Map).cast<String, Object?>();
return Transfer(
amount: (map['amount'] as num).toInt(),
amountReversed: (map['amount_reversed'] as num).toInt(),
balanceTransaction: map['balance_transaction'] == null
? null
: BalanceTransactionOrId.fromJson(map['balance_transaction']),
created:
DateTime.fromMillisecondsSinceEpoch((map['created'] as int).toInt()),
currency: (map['currency'] as String),
description:
map['description'] == null ? null : (map['description'] as String),
destination: map['destination'] == null
? null
: AccountOrId.fromJson(map['destination']),
destinationPayment: map['destination_payment'] == null
? null
: ChargeOrId.fromJson(map['destination_payment']),
id: (map['id'] as String),
livemode: (map['livemode'] as bool),
metadata: (map['metadata'] as Map).cast<String, Object?>().map((
key,
value,
) =>
MapEntry(
key,
(value as String),
)),
reversals: TransferReversals.fromJson(map['reversals']),
reversed: (map['reversed'] as bool),
sourceTransaction: map['source_transaction'] == null
? null
: ChargeOrId.fromJson(map['source_transaction']),
sourceType:
map['source_type'] == null ? null : (map['source_type'] as String),
transferGroup: map['transfer_group'] == null
? null
: (map['transfer_group'] as String),
);
}