validate method
Returns a map of the errors associated with this control.
Each entry in the map is a separate error associated with the control. The key is an identifier for the error while the value is additional information used by the component to display the error. For instance a length validator could provide information about how long the current invalid string is and the max string length for the input to display.
Implementation
@override
Map<String, dynamic>? validate(AbstractControl control) {
if (!enabled || control.value == null) return null;
assert(control.value is Comparable, 'Value needs to be comparable');
if (control.value < 0) {
return {nonNegativeIntegerRequiredErrorKey: numberIsNegativeMsg()};
}
return null;
}