validate method

  1. @override
Map<String, dynamic>? validate(
  1. AbstractControl control
)

Validation that works in concert with the number accessor.

Implementation

@override
Map<String, dynamic>? validate(AbstractControl control) {
  assert(control is Control);
  // If the control doesn't have a value, but had a value from the input then
  // it is considered an error. Producing error here as accessors can't easily
  // add errors themselves, but validators can.
  if (control.value == null && !isEmpty((control as Control).rawValue)) {
    return {inputNotNumberErrorKey: inputIsNotNumberMsg()};
  }
  return null;
}