setValue method
Implementation
void setValue(String value, int position) {
final maxIndex = _otpTextFieldState.widget.length - 1;
if (position > maxIndex) {
throw Exception(
"Provided position is out of bounds for the OtpTextField");
}
final textControllers = _otpTextFieldState._textControllers;
final textController = textControllers[position];
final currentPin = _otpTextFieldState._pin;
if (textController != null) {
textController.text = value;
currentPin[position] = value;
}
String newPin = "";
for (var item in currentPin) {
newPin += item;
}
final widget = _otpTextFieldState.widget;
if (widget.onChanged != null) {
widget.onChanged!(newPin);
}
}