validate method

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

Validation that works in concert with the number accessor.

Implementation

@override
Map<String, dynamic>? validate(AbstractControl abstractControl) {
  assert(abstractControl is Control, 'Can only be used with a Control');
  final control = abstractControl as Control;
  // Handled by accessor validator or value set by forms system
  if (control.value == null && !isBlank(control.rawValue)) {
    return {checkIntegerErrorKey: numberIsNotIntegerMsg()};
  }
  return null;
}