validator method

  1. @override
ValidationError? validator(
  1. String? value
)
override

A function that must return a validation error if the provided value is invalid and null otherwise.

Implementation

@override
ValidationError? validator(String? value) {
  if (value == null || value.isEmpty || int.tryParse(value) == null) {
    return ValidationError.invalid;
  }

  return null;
}