validate method

String? validate()

Implementation

String? validate() {
  final value = _controller.text;
  for (final validator in widget.validators) {
    final error = validator(value);
    if (error != null) {
      setState(() => _error = error);
      widget.onValidated?.call(error);
      return error;
    }
  }
  setState(() => _error = null);
  widget.onValidated?.call(null);
  return null;
}