validateValue method
Validates the value.
Returns null
if the value is valid, otherwise an error message.
Call validate() instead of this method when using the validator.
Implementation
@override
String? validateValue(T valueCandidate) {
final int? value;
if (valueCandidate is String) {
value = int.tryParse(valueCandidate);
} else if (valueCandidate is int) {
value = valueCandidate;
} else {
return errorText;
}
if (value == null) {
return errorText;
}
if (!isPrime(value)) {
return errorText;
}
return null;
}