Search code examples
flutterkeyboard

Set keyboard cursor at the end of text ios Flutter


I want to put the keyboard cursor at the end. There are two methods, but they work only in Android devices not iOS. I tried this one

comment_control.selection = TextSelection.collapsed(offset: comment_control.text.length); 

and this one

comment_control.selection = TextSelection.fromPosition(TextPosition(offset: comment_control.text.length));

They work only in Android devices and not in iOS like iphone. In ios cursor puts at the beginning when I use these to methods

How to fix this problem? is there another method? Thanks


Solution

  • Flutter team have fixed this bug in Flutter version 2.0.1. You can use my code above, it works now.