encode<V> static method
V
encode<
V>( - Transfer instance,
- Encoder<V> encoder
)
override
Implementation
static V encode<V>(
Transfer instance,
Encoder<V> encoder,
) {
final container = encoder.container<String>();
container.encodeInt(
'amount',
instance.amount,
);
container.encodeInt(
'amount_reversed',
instance.amountReversed,
);
if (instance.balanceTransaction != null) {
BalanceTransactionOrId.encode(
instance.balanceTransaction!,
container.nestedSingleValueContainer('balance_transaction').encoder,
);
}
container.encodeDateTime(
'created',
instance.created,
);
container.encodeString(
'currency',
instance.currency,
);
if (instance.description != null) {
container.encodeString(
'description',
instance.description!,
);
}
if (instance.destination != null) {
AccountOrId.encode(
instance.destination!,
container.nestedSingleValueContainer('destination').encoder,
);
}
if (instance.destinationPayment != null) {
ChargeOrId.encode(
instance.destinationPayment!,
container.nestedSingleValueContainer('destination_payment').encoder,
);
}
container.encodeString(
'id',
instance.id,
);
container.encodeBool(
'livemode',
instance.livemode,
);
container.encodeMap(
'metadata',
(container) => instance.metadata.forEach((
key,
value,
) =>
container.encodeString(
key,
value,
)),
);
container.encodeString(
'object',
'transfer',
);
TransferReversals.encode(
instance.reversals,
container.nestedSingleValueContainer('reversals').encoder,
);
container.encodeBool(
'reversed',
instance.reversed,
);
if (instance.sourceTransaction != null) {
ChargeOrId.encode(
instance.sourceTransaction!,
container.nestedSingleValueContainer('source_transaction').encoder,
);
}
if (instance.sourceType != null) {
container.encodeString(
'source_type',
instance.sourceType!,
);
}
if (instance.transferGroup != null) {
container.encodeString(
'transfer_group',
instance.transferGroup!,
);
}
return container.value;
}