encode<V> static method

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

Implementation

static V encode<V>(
  AccountFutureRequirements 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!,
    );
  }
  if (instance.currentlyDue != null) {
    container.encodeList(
      'currently_due',
      (container) =>
          instance.currentlyDue!.forEach((el) => container.encodeString(el)),
    );
  }
  if (instance.disabledReason != null) {
    container.encodeString(
      'disabled_reason',
      instance.disabledReason!,
    );
  }
  if (instance.errors != null) {
    container.encodeList(
      'errors',
      (container) =>
          instance.errors!.forEach((el) => AccountRequirementsError.encode(
                el,
                container.nestedSingleValueContainer().encoder,
              )),
    );
  }
  if (instance.eventuallyDue != null) {
    container.encodeList(
      'eventually_due',
      (container) =>
          instance.eventuallyDue!.forEach((el) => container.encodeString(el)),
    );
  }
  if (instance.pastDue != null) {
    container.encodeList(
      'past_due',
      (container) =>
          instance.pastDue!.forEach((el) => container.encodeString(el)),
    );
  }
  if (instance.pendingVerification != null) {
    container.encodeList(
      'pending_verification',
      (container) => instance.pendingVerification!
          .forEach((el) => container.encodeString(el)),
    );
  }
  return container.value;
}