encode<V> static method

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

Implementation

static V encode<V>(
  CashBalance instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.available != null) {
    container.encodeMap(
      'available',
      (container) => instance.available!.forEach((
        key,
        value,
      ) =>
          container.encodeInt(
            key,
            value,
          )),
    );
  }
  container.encodeString(
    'customer',
    instance.customer,
  );
  container.encodeBool(
    'livemode',
    instance.livemode,
  );
  container.encodeString(
    'object',
    'cash_balance',
  );
  CustomerBalanceCustomerBalanceSettings.encode(
    instance.settings,
    container.nestedSingleValueContainer('settings').encoder,
  );
  return container.value;
}