setError method

void setError([
  1. String? error
])

set error message, pass null to clear the error message

Implementation

void setError([String? error]) {
  if (_state == null) return;

  if (inputType == BadSimpleInput) {
    throw UnsupportedError('Cannot set error for simple input');
  }

  if (_state!._error != error) {
    _state!._error = error;
    _state!.update();
  }
}