validate method

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

Validates the given input and returns an error message if validation fails. Returns null if the input is valid.

Implementation

@override
String? validate(String input) {
  final emailValid = RegExp(
    r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+",
  ).hasMatch(input);

  return emailValid ? null : message;
}