validator method Null safety

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

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

Implementation

@override
StudentCodeValidationError? validator(String? value) {
  return value?.trim().isNotEmpty == true
      ? null
      : StudentCodeValidationError.empty;
}