encode<V> static method

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

Implementation

static V encode<V>(
  GelatoDocumentReport instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.address != null) {
    Address.encode(
      instance.address!,
      container.nestedSingleValueContainer('address').encoder,
    );
  }
  if (instance.dob != null) {
    GelatoDataVerifiedOutputsDate.encode(
      instance.dob!,
      container.nestedSingleValueContainer('dob').encoder,
    );
  }
  if (instance.error != null) {
    GelatoDocumentReportError.encode(
      instance.error!,
      container.nestedSingleValueContainer('error').encoder,
    );
  }
  if (instance.expirationDate != null) {
    GelatoDataVerifiedOutputsDate.encode(
      instance.expirationDate!,
      container.nestedSingleValueContainer('expiration_date').encoder,
    );
  }
  if (instance.files != null) {
    container.encodeList(
      'files',
      (container) =>
          instance.files!.forEach((el) => container.encodeString(el)),
    );
  }
  if (instance.firstName != null) {
    container.encodeString(
      'first_name',
      instance.firstName!,
    );
  }
  if (instance.issuedDate != null) {
    GelatoDataVerifiedOutputsDate.encode(
      instance.issuedDate!,
      container.nestedSingleValueContainer('issued_date').encoder,
    );
  }
  if (instance.issuingCountry != null) {
    container.encodeString(
      'issuing_country',
      instance.issuingCountry!,
    );
  }
  if (instance.lastName != null) {
    container.encodeString(
      'last_name',
      instance.lastName!,
    );
  }
  if (instance.number != null) {
    container.encodeString(
      'number',
      instance.number!,
    );
  }
  container.encodeString(
    'status',
    instance.status,
  );
  if (instance.type != null) {
    container.encodeString(
      'type',
      instance.type!,
    );
  }
  return container.value;
}