clear method

void clear()

Implementation

void clear() {
  final textFieldLength = _otpTextFieldState.widget.length;
  _otpTextFieldState._pin = List.generate(textFieldLength, (int i) {
    return '';
  });

  final textControllers = _otpTextFieldState._textControllers;
  textControllers.forEach((textController) {
    if (textController != null) {
      textController.text = '';
    }
  });

  final firstFocusNode = _otpTextFieldState._focusNodes[0];
  if (firstFocusNode != null) {
    firstFocusNode.requestFocus();
  }
}