flutter_chips_input icon indicating copy to clipboard operation
flutter_chips_input copied to clipboard

PlatformException when removing chip

Open tneotia opened this issue 4 years ago • 12 comments

Hello, I came across this error when using this package:

Stacktrace
E/MethodChannel#flutter/textinput(30524): Failed to handle method call
E/MethodChannel#flutter/textinput(30524): java.lang.IndexOutOfBoundsException: invalid composing start: 1
E/MethodChannel#flutter/textinput(30524): 	at io.flutter.embedding.engine.systemchannels.TextInputChannel$TextEditState.<init>(TextInputChannel.java:719)
E/MethodChannel#flutter/textinput(30524): 	at io.flutter.embedding.engine.systemchannels.TextInputChannel$TextEditState.fromJson(TextInputChannel.java:680)
E/MethodChannel#flutter/textinput(30524): 	at io.flutter.embedding.engine.systemchannels.TextInputChannel$1.onMethodCall(TextInputChannel.java:91)
E/MethodChannel#flutter/textinput(30524): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/MethodChannel#flutter/textinput(30524): 	at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/MethodChannel#flutter/textinput(30524): 	at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:738)
E/MethodChannel#flutter/textinput(30524): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#flutter/textinput(30524): 	at android.os.MessageQueue.next(MessageQueue.java:326)
E/MethodChannel#flutter/textinput(30524): 	at android.os.Looper.loop(Looper.java:181)
E/MethodChannel#flutter/textinput(30524): 	at android.app.ActivityThread.main(ActivityThread.java:7073)
E/MethodChannel#flutter/textinput(30524): 	at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#flutter/textinput(30524): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
E/MethodChannel#flutter/textinput(30524): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)
E/flutter (30524): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: PlatformException(error, invalid composing start: 1, null, java.lang.IndexOutOfBoundsException: invalid composing start: 1
E/flutter (30524): 	at io.flutter.embedding.engine.systemchannels.TextInputChannel$TextEditState.<init>(TextInputChannel.java:719)
E/flutter (30524): 	at io.flutter.embedding.engine.systemchannels.TextInputChannel$TextEditState.fromJson(TextInputChannel.java:680)
E/flutter (30524): 	at io.flutter.embedding.engine.systemchannels.TextInputChannel$1.onMethodCall(TextInputChannel.java:91)
E/flutter (30524): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/flutter (30524): 	at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/flutter (30524): 	at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:738)
E/flutter (30524): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter (30524): 	at android.os.MessageQueue.next(MessageQueue.java:326)
E/flutter (30524): 	at android.os.Looper.loop(Looper.java:181)
E/flutter (30524): 	at android.app.ActivityThread.main(ActivityThread.java:7073)
E/flutter (30524): 	at java.lang.reflect.Method.invoke(Native Method)
E/flutter (30524): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
E/flutter (30524): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)
E/flutter (30524): )
E/flutter (30524): #0      JSONMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:159:7)
E/flutter (30524): #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:159:18)
E/flutter (30524): <asynchronous suspension>
flutter doctor -v
[√] Flutter (Channel beta, 1.25.0-8.2.pre, on Microsoft Windows [Version 10.0.19042.782], locale en-US)
    • Flutter version 1.25.0-8.2.pre at C:\flutter
    • Framework revision b0a2299859 (3 weeks ago), 2021-01-05 12:34:13 -0800
    • Engine revision 92ae191c17
    • Dart version 2.12.0 (build 2.12.0-133.2.beta)

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at C:\Users\tanay\AppData\Local\Android\sdk
    • Platform android-30, build-tools 30.0.2
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[√] Android Studio (version 4.1.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.52.1)
    • VS Code at C:\Users\tanay\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.17.0

[√] Connected device (1 available)
    • SM G950U1 (mobile) • 192.168.0.104:5555 • android-arm64 • Android 9 (API 28)

• No issues found!

I get the error when removing chips with the "x" button, and for some reason backspace doesn't work at all (this doesn't throw any error though)

tneotia avatar Jan 25 '21 17:01 tneotia

@tneotia This stack trace doesn't look related to the flutter_chips_input package at all. Are you able to reproduce this issue with the example app? Or can you provide some concise sample code that reproduces the problem?

awhitford avatar Jan 27 '21 04:01 awhitford

Yes it is reproducible in the example app.

https://user-images.githubusercontent.com/50850142/105997205-5814ce80-6079-11eb-8bdb-7bf4161df52b.mp4

I get the same flutter error in the logs as the stack trace above.

tneotia avatar Jan 27 '21 13:01 tneotia

I was not able to reproduce this with the stable channel, but I was able to reproduce it with the beta channel.

awhitford avatar Jan 30 '21 06:01 awhitford

I figured... I thought it was an issue with Flutter since backspace doesn't work on normal texfields. Would this be fixable in the package or do you think Flutter side needs to be fixed?

tneotia avatar Jan 30 '21 14:01 tneotia

This definitely looks like a Flutter issue to me because I don't see the package code in the stack trace.

I recommend ensuring that there is a Flutter issue recorded. If there is one already, great, otherwise one should be added. Alas, we need a minimal reproducible test case (Flutter only).

awhitford avatar Jan 30 '21 15:01 awhitford

Another observation is that this issue seems related to Android because I was not able to reproduce it with the iPhone simulator.

awhitford avatar Jan 30 '21 15:01 awhitford

Yes it is related to Android, there are two Flutter issues I found earlier regarding backspace issues:

https://github.com/flutter/flutter/issues/73433

https://github.com/flutter/flutter/issues/73544

Are you testing on a Samsung device?

tneotia avatar Jan 30 '21 16:01 tneotia

I don't have a Samsung device. I'm just testing with AVD/emulator.

awhitford avatar Jan 30 '21 16:01 awhitford

is it fixed i am also facing the same issue

MuhammadTalhaSarwar avatar Mar 17 '21 10:03 MuhammadTalhaSarwar

Is it fixed ?? please fix

sabininnov avatar May 12 '21 09:05 sabininnov

@tneotia did you find any solution for this bug? I also have the flutter_chips_input package implemented, and it reproduces this bug with Default Samsung Keyboard.

clauub avatar Jun 24 '21 08:06 clauub

Is this fixed?? Still facing this issue with version 1.10.0

shabeenabarde avatar Sep 16 '21 09:09 shabeenabarde