validate method

String? validate()

Implementation

String? validate() {
  if (error != null) {
    return error;
  }
  if (isRequired) {
    if (_value == null) {
      return "Field $name is required";
    }
  }
  return null;
}