setError method
Sets the error message for an item.
Pass null or empty string to clear the error.
Implementation
void setError(int index, String? error) {
if (index >= 0 && index < _errors.length) {
_errors[index] = (error?.isEmpty ?? true) ? null : error;
}
}