encode<V> static method
V
encode<
V>( - BankAccount instance,
- Encoder<V> encoder
)
override
Implementation
static V encode<V>(
BankAccount instance,
Encoder<V> encoder,
) {
final container = encoder.container<String>();
if (instance.account != null) {
AccountOrId.encode(
instance.account!,
container.nestedSingleValueContainer('account').encoder,
);
}
if (instance.accountHolderName != null) {
container.encodeString(
'account_holder_name',
instance.accountHolderName!,
);
}
if (instance.accountHolderType != null) {
container.encodeString(
'account_holder_type',
instance.accountHolderType!,
);
}
if (instance.accountType != null) {
container.encodeString(
'account_type',
instance.accountType!,
);
}
if (instance.availablePayoutMethods != null) {
container.encodeList(
'available_payout_methods',
(container) => instance.availablePayoutMethods!
.forEach((el) => container.encodeString(el)),
);
}
if (instance.bankName != null) {
container.encodeString(
'bank_name',
instance.bankName!,
);
}
container.encodeString(
'country',
instance.country,
);
container.encodeString(
'currency',
instance.currency,
);
if (instance.customer != null) {
BankAccountCustomerOrId.encode(
instance.customer!,
container.nestedSingleValueContainer('customer').encoder,
);
}
if (instance.defaultForCurrency != null) {
container.encodeBool(
'default_for_currency',
instance.defaultForCurrency!,
);
}
if (instance.fingerprint != null) {
container.encodeString(
'fingerprint',
instance.fingerprint!,
);
}
if (instance.futureRequirements != null) {
BankAccountFutureRequirements.encode(
instance.futureRequirements!,
container.nestedSingleValueContainer('future_requirements').encoder,
);
}
container.encodeString(
'id',
instance.id,
);
container.encodeString(
'last4',
instance.last4,
);
if (instance.metadata != null) {
container.encodeMap(
'metadata',
(container) => instance.metadata!.forEach((
key,
value,
) =>
container.encodeString(
key,
value,
)),
);
}
container.encodeString(
'object',
'bank_account',
);
if (instance.requirements != null) {
BankAccountFutureRequirements.encode(
instance.requirements!,
container.nestedSingleValueContainer('requirements').encoder,
);
}
if (instance.routingNumber != null) {
container.encodeString(
'routing_number',
instance.routingNumber!,
);
}
container.encodeString(
'status',
instance.status,
);
return container.value;
}