Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug report] '!composingRange.isValid || composingRange.isCollapsed': is not true #200

Open
Geparder opened this issue Mar 13, 2023 · 7 comments

Comments

@Geparder
Copy link

Version

11.0.1

Platforms

Android

Device Model

Emulator

flutter info

When I move the carriage to the end of the text, where there is an Extended WidgetSpan, an error occurs:

Failed assertion: line 2551 pos 16: '!composingRange.isValid || composingRange.isCollapsed': is not true.

How to reproduce?

There are several ExtendedWidgetSpans in the text. I click on the screen and translate courses to the end of the text.

Example:

This is an example of text with {item1} and {item2}. And I click here.

Logs

======== Exception caught by scheduler library =====================================================
The following assertion was thrown during a scheduler callback:
'package:extended_text_field/src/extended_editable_text.dart': Failed assertion: line 2551 pos 16: '!composingRange.isValid || composingRange.isCollapsed': is not true.

When the exception was thrown, this was the stack: 
#2      ExtendedEditableTextState._updateComposingRectIfNeeded (package:extended_text_field/src/extended_editable_text.dart:2551:16)
#3      ExtendedEditableTextState._updateComposingRectIfNeeded.<anonymous closure> (package:extended_text_field/src/extended_editable_text.dart:2559:49)
#4      SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1289:15)
#5      SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1227:9)
#6      SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1076:5)
#10     _invoke (dart:ui/hooks.dart:147:10)
#11     PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:338:5)
#12     _drawFrame (dart:ui/hooks.dart:112:31)
(elided 5 frames from class _AssertionError and dart:async)

Example code (optional)

No response

Contact

No response

@Geparder Geparder changed the title [Bug report] [Bug report] '!composingRange.isValid || composingRange.isCollapsed': is not true Mar 13, 2023
@zmtzawqlp
Copy link
Member

any runnable simple demo?

@Geparder
Copy link
Author

Geparder commented Mar 14, 2023

This error is reproduced by the example attached in this repository.
Example video: https://drive.google.com/file/d/1efq6sTkB8qkYKc0Hb5WFDnC1mJUfJXIU/view?usp=sharing

@zmtzawqlp
Copy link
Member

"extended_text_field" from pub.dev, specifically version 12.0.0, which claims to have synchronized the official code. Please give it a try, and if you still encounter issues, feel free to reopen it.

@Geparder
Copy link
Author

In version 12.0.0 the error is repeated

@zmtzawqlp
Copy link
Member

can you reprduce it at a really smartphone? i can't reproduce it at my side.

@zmtzawqlp zmtzawqlp reopened this May 29, 2023
@Geparder
Copy link
Author

The error is not repeated on a real device. Only on a virtual machine. Thank you!

@Evenjine
Copy link

The error is not repeated on a real device. Only on a virtual machine. Thank you!

This error is caused by an assert keyword. In development and debugging, if the condition inside the assert is not true, it will trigger an exception. a temporary solution is to comment out the assert line.

open the Editable_text.dart and comment out this line:
//assert(!composingRange.isValid || composingRange.isCollapsed);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants