validate method

  1. @override
String? validate(
  1. BuildContext context,
  2. String fieldName,
  3. String? value
)
override

Function to validate the form input. It takes a string and returns an String error message if the input is invalid or null if the input is valid.

Implementation

@override
String? validate(
  BuildContext context,
  String fieldName,
  String? value,
) {
  if (value != null && value.isNotEmpty) {
    _isValid = callback(value);
  } else {
    _isValid = true;
  }
  return _shortErrorMessage;
}