Skip to content

[Web] [Desktop] - Text editor disappear when pressing delete on keyboard #402

@reke592

Description

@reke592

Hi, I want to report an issue in the editor, on initialization I use an empty document for the quill controller

final _emptyDescriptionDoc = Document()..insert(0, '');
_descriptionsController = new QuillController(document: _emptyDescriptionDoc, selection: const TextSelection.collapsed(offset: 0));

while editing when the document is empty, pressing the backspace will work as expected, but when I press the delete key the text editor will disappear because of an error.

pubspec.yaml

flutter_quill: ^2.0.3

Flutter version and doctor

Flutter 2.5.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 4cc385b4b8 (7 days ago) • 2021-09-07 23:01:49 -0700
Engine • revision f0826da7ef
Tools • Dart 2.14.0

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.5.0, on Microsoft Windows [Version 10.0.19042.1165], locale en-PH)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[√] Chrome - develop for the web
[!] Visual Studio - develop for Windows (Visual Studio Community 2017 15.9.33)
    X Visual Studio 2019 or later is required.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 3.5)
[√] VS Code (version 1.60.0)
[√] Connected device (3 available)

! Doctor found issues in 1 category.

Error log

The following TypeErrorImpl was thrown while dispatching notifications for QuillController:
Expected a value of type 'Block', but got one of type 'Null'

When the exception was thrown, this was the stack:
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 251:49      throw_
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 84:3        castError
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 452:10  cast
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/classes.dart 633:14     as_C
packages/flutter_quill/src/models/documents/document.dart 135:28                                                               queryChild
packages/flutter_quill/src/models/documents/document.dart 120:17                                                               collectStyle
packages/flutter_quill/src/widgets/controller.dart 69:10                                                                       getSelectionStyle
packages/flutter_quill/src/widgets/toolbar/toggle_style_button.dart 48:50                                                      get [_selectionStyle]
packages/flutter_quill/src/widgets/toolbar/toggle_style_button.dart 87:63                                                      <fn>
packages/flutter/src/widgets/framework.dart 1088:30                                                                            setState
packages/flutter_quill/src/widgets/toolbar/toggle_style_button.dart 87:5                                                       [_didChangeEditingValue]
packages/flutter/src/foundation/change_notifier.dart 308:24                                                                    notifyListeners
packages/flutter_quill/src/widgets/controller.dart 174:5                                                                       replaceText
packages/flutter_quill/src/widgets/raw_editor/raw_editor_state_text_input_client_mixin.dart 170:23                             updateEditingValue
packages/flutter/src/services/text_input.dart 1386:9                                                                           _handleTextInputInvocation
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54                runBody
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 123:5                _async
packages/flutter/src/services/text_input.dart 1331:45                                                                          [_handleTextInputInvocation]
packages/flutter/src/services/platform_channel.dart 386:55                                                                     _handleAsMethodCall
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54                runBody
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 123:5                _async
packages/flutter/src/services/platform_channel.dart 383:40                                                                     [_handleAsMethodCall]
packages/flutter/src/services/platform_channel.dart 379:34                                                                     <fn>
packages/flutter/src/services/binding.dart 379:35                                                                              <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54                runBody
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 123:5                _async
packages/flutter/src/services/binding.dart 376:98                                                                              <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/flutter_web_sdk/lib/_engine/engine/platform_dispatcher.dart 1034:13               invoke2
C:/b/s/w/ir/cache/builder/src/out/host_debug/flutter_web_sdk/lib/ui/src/ui/channel_buffers.dart 25:5                           invoke
C:/b/s/w/ir/cache/builder/src/out/host_debug/flutter_web_sdk/lib/ui/src/ui/channel_buffers.dart 65:7                           push
C:/b/s/w/ir/cache/builder/src/out/host_debug/flutter_web_sdk/lib/ui/src/ui/channel_buffers.dart 130:16                         push
C:/b/s/w/ir/cache/builder/src/out/host_debug/flutter_web_sdk/lib/_engine/engine/platform_dispatcher.dart 302:25                invokeOnPlatformMessage
C:/b/s/w/ir/cache/builder/src/out/host_debug/flutter_web_sdk/lib/_engine/engine/text_editing/text_editing.dart 1662:39         updateEditingState
C:/b/s/w/ir/cache/builder/src/out/host_debug/flutter_web_sdk/lib/_engine/engine/text_editing/text_editing.dart 1770:17         <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/flutter_web_sdk/lib/_engine/engine/text_editing/text_editing.dart 974:7           handleChange
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 334:14  _checkAndCall
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 339:39  dcall
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/html/dart2js/html_dart2js.dart 37308:58                              <fn>

The QuillController sending notification was:
  Instance of 'QuillController'
════════════════════════════════════════════════════════════════════════════════════════════════════
Another exception was thrown: Expected a value of type 'Block', but got one of type 'Null'
Another exception was thrown: Expected a value of type 'Block', but got one of type 'Null'
Another exception was thrown: Expected a value of type 'Block', but got one of type 'Null'
Another exception was thrown: Expected a value of type 'Block', but got one of type 'Null'
Another exception was thrown: Expected a value of type 'Block', but got one of type 'Null'
Another exception was thrown: Expected a value of type 'Block', but got one of type 'Null'
Another exception was thrown: Expected a value of type 'Block', but got one of type 'Null'
Another exception was thrown: Expected a value of type 'Block', but got one of type 'Null'
Another exception was thrown: Expected a value of type 'Block', but got one of type 'Null'
Another exception was thrown: Expected a value of type 'Block', but got one of type 'Null'
Another exception was thrown: Expected a value of type 'Block', but got one of type 'Null'
Another exception was thrown: Assertion failed: file:///C:/Users/NBS-ECR/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_quill-2.0.3/lib/src/widgets/editor.dart:1133:12
Another exception was thrown: Assertion failed: file:///C:/Users/NBS-ECR/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_quill-2.0.3/lib/src/widgets/editor.dart:1133:12
Another exception was thrown: Assertion failed: file:///C:/Users/NBS-ECR/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_quill-2.0.3/lib/src/widgets/editor.dart:1133:12
Another exception was thrown: Assertion failed: file:///C:/Users/NBS-ECR/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_quill-2.0.3/lib/src/widgets/editor.dart:1133:12
Another exception was thrown: Assertion failed: file:///C:/Users/NBS-ECR/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_quill-2.0.3/lib/src/widgets/editor.dart:1133:12
Another exception was thrown: Assertion failed: file:///C:/Users/NBS-ECR/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_quill-2.0.3/lib/src/widgets/editor.dart:1133:12
Another exception was thrown: Assertion failed: file:///C:/Users/NBS-ECR/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_quill-2.0.3/lib/src/widgets/editor.dart:1133:12
Another exception was thrown: Assertion failed: file:///C:/Users/NBS-ECR/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_quill-2.0.3/lib/src/widgets/editor.dart:1133:12
Another exception was thrown: Assertion failed: file:///C:/Users/NBS-ECR/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_quill-2.0.3/lib/src/widgets/editor.dart:1133:12
Another exception was thrown: Assertion failed: file:///C:/Users/NBS-ECR/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_quill-2.0.3/lib/src/widgets/editor.dart:1133:12
Another exception was thrown: Assertion failed: file:///C:/Users/NBS-ECR/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_quill-2.0.3/lib/src/widgets/editor.dart:1133:12
Another exception was thrown: Assertion failed: file:///C:/Users/NBS-ECR/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_quill-2.0.3/lib/src/widgets/editor.dart:1133:12
Another exception was thrown: Assertion failed: file:///C:/Users/NBS-ECR/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_quill-2.0.3/lib/src/widgets/editor.dart:1133:12
Another exception was thrown: Assertion failed: file:///C:/Users/NBS-ECR/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_quill-2.0.3/lib/src/widgets/editor.dart:1133:12

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions