-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
a: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsc: crashStack traces logged to the consoleStack traces logged to the consoleplatform-androidAndroid applications specificallyAndroid applications specifically
Description
Steps to Reproduce
Set the text property of a TextEditingController to the empty string throws a confusing error. I'm forced to use the clear method. This works fine but is a bit annoying since I have to check if the string is empty and, if so, call clear() instead.
Perhaps this is not a big just a documentation issue -- programmers should account for the empty string and call the clear() method instead -- but I can't find anything that indicates this should be the case. Either way, the error thrown was quite confusing.
Logs
E/MethodChannel#flutter/textinput(23127): Failed to handle method call
E/MethodChannel#flutter/textinput(23127): java.lang.IndexOutOfBoundsException: setSpan (1 ... 1) ends beyond length 0
E/MethodChannel#flutter/textinput(23127): at android.text.SpannableStringBuilder.checkRange(SpannableStringBuilder.java:1265)
E/MethodChannel#flutter/textinput(23127): at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:684)
E/MethodChannel#flutter/textinput(23127): at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:677)
E/MethodChannel#flutter/textinput(23127): at android.text.Selection.setSelection(Selection.java:76)
E/MethodChannel#flutter/textinput(23127): at io.flutter.plugin.editing.TextInputPlugin.applyStateToSelection(TextInputPlugin.java:141)
E/MethodChannel#flutter/textinput(23127): at io.flutter.plugin.editing.TextInputPlugin.setTextInputEditingState(TextInputPlugin.java:160)
E/MethodChannel#flutter/textinput(23127): at io.flutter.plugin.editing.TextInputPlugin.onMethodCall(TextInputPlugin.java:67)
E/MethodChannel#flutter/textinput(23127): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:191)
E/MethodChannel#flutter/textinput(23127): at io.flutter.view.FlutterView.handlePlatformMessage(FlutterView.java:643)
E/MethodChannel#flutter/textinput(23127): at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#flutter/textinput(23127): at android.os.MessageQueue.next(MessageQueue.java:323)
E/MethodChannel#flutter/textinput(23127): at android.os.Looper.loop(Looper.java:136)
E/MethodChannel#flutter/textinput(23127): at android.app.ActivityThread.main(ActivityThread.java:6119)
E/MethodChannel#flutter/textinput(23127): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#flutter/textinput(23127): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
E/MethodChannel#flutter/textinput(23127): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Flutter Doctor
[✓] Flutter (on Linux, locale en_US.UTF-8, channel alpha)
• Flutter at /usr/local/jxmorris12/flutter
• Framework revision 6f77b4a9a7 (2 weeks ago), 2017-06-14 17:27:08 -0700
• Engine revision 18fdfb86bb
• Tools Dart version 1.24.0-dev.6.7
[✓] Android toolchain - develop for Android devices (Android SDK 26.0.0)
• Android SDK at /usr/local/jxmorris12/Android/Sdk
• Platform android-26, build-tools 26.0.0
• Java binary at: /usr/local/jxmorris12/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)
[✓] Android Studio (version 2.3)
• Android Studio at /usr/local/jxmorris12/android-studio
• Gradle version 3.2
• Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)
[✓] IntelliJ IDEA Ultimate Edition (version 2017.1)
• Flutter plugin version 14.0
• Dart plugin version 171.4424
[✓] Connected devices
• Nexus 5X • 00e6cfc012b1c2ec • android-arm • Android 7.1.1 (API 25)
For more information about diagnosing and reporting Flutter bugs, please see https://flutter.io/bug-reports/.
Metadata
Metadata
Assignees
Labels
a: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsc: crashStack traces logged to the consoleStack traces logged to the consoleplatform-androidAndroid applications specificallyAndroid applications specifically