encode<V> static method

V encode<V>(
  1. Token instance,
  2. Encoder<V> encoder
)

Implementation

static V encode<V>(
  Token instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.bankAccount != null) {
    BankAccount.encode(
      instance.bankAccount!,
      container.nestedSingleValueContainer('bank_account').encoder,
    );
  }
  if (instance.card != null) {
    Card.encode(
      instance.card!,
      container.nestedSingleValueContainer('card').encoder,
    );
  }
  if (instance.clientIp != null) {
    container.encodeString(
      'client_ip',
      instance.clientIp!,
    );
  }
  container.encodeDateTime(
    'created',
    instance.created,
  );
  container.encodeString(
    'id',
    instance.id,
  );
  container.encodeBool(
    'livemode',
    instance.livemode,
  );
  container.encodeString(
    'object',
    'token',
  );
  container.encodeString(
    'type',
    instance.type,
  );
  container.encodeBool(
    'used',
    instance.used,
  );
  return container.value;
}