setTextSelection method

void setTextSelection(
  1. int index
)

Sets text selection in the current OTP input field.

Implementation

void setTextSelection(int index) {
  currentIndex = index;

  list[index].textEditingController!.selection = TextSelection(
    baseOffset: 0,
    extentOffset: list[index].textEditingController!.text.length,
  );
}