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

Assertion Failure in line.dart When Editing Text with Block-Level Attributes in Debug Mode #2150

Closed
1 task done
Gabianne01 opened this issue Aug 26, 2024 · 1 comment · Fixed by #2174
Closed
1 task done
Labels
bug Something isn't working

Comments

@Gabianne01
Copy link

Gabianne01 commented Aug 26, 2024

Is there an existing issue for this?

Flutter Quill version

10.4.5

Steps to reproduce

  1. Create a text using the Flutter Quill editor.
  2. Apply a block-level attribute (e.g., list, alignment).
  3. Delete a character in the text.
  4. Continue typing.
  5. Observe that the new text does not appear until the editor loses focus.

Expected results

Text should appear immediately when typed, without requiring the editor to lose focus. No assertion failures should occur.

Actual results

In debug mode, the text does not appear until the editor loses focus. An assertion failure occurs in line.dart on line 147.

Code sample

No response

Additional Context

I've encountered an assertion failure when using the Flutter Quill editor in debug mode. This issue occurs specifically when I apply block-level attributes (such as lists or alignment) to text, delete a character, and then attempt to type again. The issue manifests as follows:

Behavior in Debug Mode:

After deleting a character, any further typing does not immediately appear in the editor.
The typed text only becomes visible after the editor loses focus.
The following assertion is thrown:

Behavior in Release Mode:

The issue does not occur in release mode. The editor behaves as expected, with no assertion failure or delayed text rendering.

The issue might be related to https://github.com/singerdmx/flutter-quill/issues/1622

Logs
Exception caught by services library
The following assertion was thrown during method call TextInputClient.updateEditingState:
'package:flutter_quill/src/document/nodes/line.dart': Failed assertion: line 147 pos 14: 'style.values.every((attr) =>
attr.scope == AttributeScope.inline || attr.scope == AttributeScope.ignore)': is not true.
@Gabianne01 Gabianne01 added the bug Something isn't working label Aug 26, 2024
@AtlasAutocode
Copy link
Collaborator

The assertion is bringing our attention to a fault in the logic.
Simply removing the assert, or using release mode, is not the correct solution as it corrupts the quill deltas and is likely to cause other problems at a later time.

The fault is in the caller, but I have not found the root cause yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
4 participants
@AtlasAutocode @Gabianne01 and others