encode<V> static method

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

Implementation

static V encode<V>(
  AccountCapabilityRequirements instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.alternatives != null) {
    container.encodeList(
      'alternatives',
      (container) => instance.alternatives!
          .forEach((el) => AccountRequirementsAlternative.encode(
                el,
                container.nestedSingleValueContainer().encoder,
              )),
    );
  }
  if (instance.currentDeadline != null) {
    container.encodeDateTime(
      'current_deadline',
      instance.currentDeadline!,
    );
  }
  container.encodeList(
    'currently_due',
    (container) =>
        instance.currentlyDue.forEach((el) => container.encodeString(el)),
  );
  if (instance.disabledReason != null) {
    container.encodeString(
      'disabled_reason',
      instance.disabledReason!,
    );
  }
  container.encodeList(
    'errors',
    (container) =>
        instance.errors.forEach((el) => AccountRequirementsError.encode(
              el,
              container.nestedSingleValueContainer().encoder,
            )),
  );
  container.encodeList(
    'eventually_due',
    (container) =>
        instance.eventuallyDue.forEach((el) => container.encodeString(el)),
  );
  container.encodeList(
    'past_due',
    (container) =>
        instance.pastDue.forEach((el) => container.encodeString(el)),
  );
  container.encodeList(
    'pending_verification',
    (container) => instance.pendingVerification
        .forEach((el) => container.encodeString(el)),
  );
  return container.value;
}