encode<V> static method

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

Implementation

static V encode<V>(
  GelatoSessionDocumentOptions instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.allowedTypes != null) {
    container.encodeList(
      'allowed_types',
      (container) => instance.allowedTypes!
          .forEach((el) => GelatoReportDocumentOptionsAllowedTypesItem.encode(
                el,
                container.nestedSingleValueContainer().encoder,
              )),
    );
  }
  if (instance.requireIdNumber != null) {
    container.encodeBool(
      'require_id_number',
      instance.requireIdNumber!,
    );
  }
  if (instance.requireLiveCapture != null) {
    container.encodeBool(
      'require_live_capture',
      instance.requireLiveCapture!,
    );
  }
  if (instance.requireMatchingSelfie != null) {
    container.encodeBool(
      'require_matching_selfie',
      instance.requireMatchingSelfie!,
    );
  }
  return container.value;
}