validate method
void
validate()
Implementation
void validate() {
if (prompt.isEmpty) {
throw SDKException.validationFailed(
'prompt is required',
fieldPath: 'DiffusionGenerationOptions.prompt',
);
}
if (steps < 0 || steps > 50) {
throw SDKException.validationFailed(
'steps must be in 0...50 (got $steps)',
fieldPath: 'DiffusionGenerationOptions.steps',
);
}
if (!guidanceScale.isFinite || guidanceScale < 0.0 || guidanceScale > 20.0) {
throw SDKException.validationFailed(
'guidance_scale must be in 0.0...20.0 (got $guidanceScale)',
fieldPath: 'DiffusionGenerationOptions.guidance_scale',
);
}
if (!strength.isFinite || strength < 0.0 || strength > 1.0) {
throw SDKException.validationFailed(
'strength must be in 0.0...1.0 (got $strength)',
fieldPath: 'DiffusionGenerationOptions.strength',
);
}
final effectiveN = hasN() ? n : 1;
if (effectiveN < 1 || effectiveN > 8) {
throw SDKException.validationFailed(
'n must be in 1...8 (got $effectiveN)',
fieldPath: 'DiffusionGenerationOptions.n',
);
}
}