Topup.fromJson constructor
Topup.fromJson(
- Object? json
Implementation
factory Topup.fromJson(Object? json) {
final map = (json as Map).cast<String, Object?>();
return Topup(
amount: (map['amount'] 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),
expectedAvailabilityDate: map['expected_availability_date'] == null
? null
: (map['expected_availability_date'] as num).toInt(),
failureCode:
map['failure_code'] == null ? null : (map['failure_code'] as String),
failureMessage: map['failure_message'] == null
? null
: (map['failure_message'] as String),
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),
)),
source: map['source'] == null ? null : Source.fromJson(map['source']),
statementDescriptor: map['statement_descriptor'] == null
? null
: (map['statement_descriptor'] as String),
status: TopupStatus.fromJson(map['status']),
transferGroup: map['transfer_group'] == null
? null
: (map['transfer_group'] as String),
);
}