<p dir="auto">Run your app on an Android Emulator</p>
<p dir="auto">Type something in a textformfield (which has a validator)<br>
call .clear() on a TextEditingController</p>
<p dir="auto">Type with the on screen keyboard: fine<br>
Type with your computer's keyboard: crash<br>
iOS: fine</p>
<p dir="auto"><code class="notranslate">E/AndroidRuntime(21783): java.lang.IndexOutOfBoundsException: replace (0 ... -1) has end before start E/AndroidRuntime(21783): 	at android.text.SpannableStringBuilder.checkRange(SpannableStringBuilder.java:1302)</code></p>
<p dir="auto">There is strange situation, when I enter the value for Phone number after completing the above fields then app crashes. All the text fields are right aligned. And keyboardType = TextInputType.text. But for phone number field keyboardType is TextInputType.phone.<br>
If I change the keyboardType: to TextInputType.text then it works fine.</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/1140343/45113283-5faf4200-b163-11e8-83d7-034799b2354c.jpeg"><img src="https://user-images.githubusercontent.com/1140343/45113283-5faf4200-b163-11e8-83d7-034799b2354c.jpeg" alt="screenshot_2018-09-05-23-19-33-088" style="max-width: 100%;"></a></p>
<p dir="auto">Error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Fatal Exception: java.lang.IndexOutOfBoundsException: replace (0 ... -1) has end before start
       at android.text.SpannableStringBuilder.checkRange(SpannableStringBuilder.java:1258)
       at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:515)
       at android.text.SpannableStringBuilder.delete(SpannableStringBuilder.java:230)
       at android.text.SpannableStringBuilder.delete(SpannableStringBuilder.java:229)
       at io.flutter.plugin.editing.InputConnectionAdaptor.sendKeyEvent(InputConnectionAdaptor.java:163)
       at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:440)
       at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:93)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:154)
       at android.app.ActivityThread.main(ActivityThread.java:6119)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)"><pre class="notranslate"><code class="notranslate">Fatal Exception: java.lang.IndexOutOfBoundsException: replace (0 ... -1) has end before start
       at android.text.SpannableStringBuilder.checkRange(SpannableStringBuilder.java:1258)
       at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:515)
       at android.text.SpannableStringBuilder.delete(SpannableStringBuilder.java:230)
       at android.text.SpannableStringBuilder.delete(SpannableStringBuilder.java:229)
       at io.flutter.plugin.editing.InputConnectionAdaptor.sendKeyEvent(InputConnectionAdaptor.java:163)
       at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:440)
       at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:93)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:154)
       at android.app.ActivityThread.main(ActivityThread.java:6119)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
</code></pre></div>