encode<V> static method

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

Implementation

static V encode<V>(
  InternalCard instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.brand != null) {
    container.encodeString(
      'brand',
      instance.brand!,
    );
  }
  if (instance.country != null) {
    container.encodeString(
      'country',
      instance.country!,
    );
  }
  if (instance.expMonth != null) {
    container.encodeInt(
      'exp_month',
      instance.expMonth!,
    );
  }
  if (instance.expYear != null) {
    container.encodeInt(
      'exp_year',
      instance.expYear!,
    );
  }
  if (instance.last4 != null) {
    container.encodeString(
      'last4',
      instance.last4!,
    );
  }
  return container.value;
}