validate static method
Implementation
static String? validate(
String? value, {
bool required = false,
double max = 100,
}) {
if (value == null || value.trim().isEmpty) {
return required ? ConectarDesignSystem.labels.requiredField : null;
}
final tax = double.tryParse(value.trim().replaceAll(',', '.'));
if (tax == null || tax.isNaN || tax < 0 || tax > max) {
return ConectarDesignSystem.labels.taxOutOfRange
.replaceAll('{max}', _formatMax(max));
}
return null;
}