validate method

  1. @override
String? validate(
  1. String? value
)
override

Returns String containing the error message if value is invalid. or null when value is valid.

Implementation

@override
String? validate(String? value) {
  final regex = RegExp(pattern);
  return !regex.hasMatch(value ?? '') ? message : null;
}