In android we can get the starting and ending index of selected text in an EditText using this :
int a = inputET.getSelectionStart();
int b = inputET.getSelectionEnd();
What is the flutter alternative for this in a TextField ?
It can be a bit more straightforward than Fayaz's answer: with a TextField(controller: _textEditingController)
one can access the selected text like this:
_textEditingController.selection.textInside(_textEditingController.text)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With