onChanged method

void onChanged(
  1. String value,
  2. int index
)

Implementation

void onChanged(String value, int index) {
  if (_isDisposed) return;

  if (hasError) hasError = false;

  if (value.length > 1) {
    _handlePaste(value);
    return;
  }

  if (value.isEmpty) {
    if (index > 0) focusNodes[index - 1].requestFocus();
    _notifyValueChanged();
    return;
  }

  if (index < length - 1) {
    focusNodes[index + 1].requestFocus();
  } else {
    focusNodes[index].unfocus();
    _submit();
  }

  _notifyValueChanged();
}