When I user showListBullets or showListNumbers the editor triggers an error when I press return twice.
To reproduce:
enter any text
press return
enable the listBullets or ListNumber
type A and press return
type B and press return
press return again
type C
ERROR
When you press return twice, the bullet or number is disabled, which is the behaviour expected. however, when you try to type after the list is disabled it triggers an error.
Note that for the same scenario, if the user disable the button and type anything it does work as expected.
So the problem only occurs when the user press return twice to disable the list (bullet or number).
Error
TextInputClient.updateEditingState:
'package:flutter_quill/src/models/documents/nodes/container.dart':
Failed assertion: line 123 pos 12: 'index == 0 || (index > 0 &&
index < length)': is not true.
When the exception was thrown, this was the stack:
My issue is about Mobile.
When I user showListBullets or showListNumbers the editor triggers an error when I press return twice.
To reproduce:
ERROR
When you press return twice, the bullet or number is disabled, which is the behaviour expected. however, when you try to type after the list is disabled it triggers an error.
Note that for the same scenario, if the user disable the button and type anything it does work as expected.
So the problem only occurs when the user press return twice to disable the list (bullet or number).
Error
'package:flutter_quill/src/models/documents/nodes/container.dart': Failed assertion: line 123 pos 12: 'index == 0 || (index > 0 && index < length)': is not true.
2 Container.insert (package:flutter_quill/src/models/documents/nodes/container.dart:123:12)
3 Document.compose (package:flutter_quill/src/models/documents/document.dart:281:15)
4 Document.insert (package:flutter_quill/src/models/documents/document.dart:83:5)
5 Document.replace (package:flutter_quill/src/models/documents/document.dart:121:15)
6 QuillController.replaceText (package:flutter_quill/src/widgets/controller.dart:236:24)
7 RawEditorStateTextInputClientMixin.updateEditingValue (package:flutter_quill/src/widgets/raw_editor/raw_editor_state_text_input_client_mixin.dart:192:25)
8 TextInput._updateEditingValue
text_input.dart:2012
9 TextInput._handleTextInputInvocation
text_input.dart:1845
10 TextInput._loudlyHandleTextInputInvocation
text_input.dart:1746
11 MethodChannel._handleAsMethodCall
platform_channel.dart:547
12 MethodChannel.setMethodCallHandler.
platform_channel.dart:540
13 _DefaultBinaryMessenger.setMessageHandler.
binding.dart:479
14 _invoke2. (dart:ui/hooks.dart:177:15)
18 _invoke2 (dart:ui/hooks.dart:176:10)
19 _ChannelCallbackRecord.invoke (dart:ui/channel_buffers.dart:40:5)
20 _Channel.push (dart:ui/channel_buffers.dart:130:31)
21 ChannelBuffers.push (dart:ui/channel_buffers.dart:326:17)
22 PlatformDispatcher._dispatchPlatformMessage (dart:ui/platform_dispatcher.dart:686:22)
23 _dispatchPlatformMessage (dart:ui/hooks.dart:86:31)
[onFlutterError] #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61)
1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:40:5)
2 Container.insert (package:flutter_quill/src/models/documents/nodes/container.dart:123:12)
3 Document.compose (package:flutter_quill/src/models/documents/document.dart:281:15)
4 Document.insert (package:flutter_quill/src/models/documents/document.dart:83:5)
5 Document.replace (package:flutter_quill/src/models/documents/document.dart:121:15)
6 QuillController.replaceText (package:flutter_quill/src/widgets/controller.dart:236:24)
7 RawEditorStateTextInputClientMixin.updateEditingValue (package:flutter_quill/src/widgets/raw_editor/raw_editor_state_text_input_client_mixin.dart:192:25)
8 TextInput._updateEditingValue
text_input.dart:2012
9 TextInput._handleTextInputInvocation
text_input.dart:1845
10 TextInput._loudlyHandleTextInputInvocation
text_input.dart:1746
11 MethodChannel._handleAsMethodCall
platform_channel.dart:547
12 MethodChannel.setMethodCallHandler.
platform_channel.dart:540
13 _DefaultBinaryMessenger.setMessageHandler.
binding.dart:479
14 _invoke2. (dart:ui/hooks.dart:177:15)
15 _rootRun (dart:async/zone.dart:1399:13)
16 _CustomZone.run (dart:async/zone.dart:1301:19)
17 _CustomZone.runGuarded (dart:async/zone.dart:1209:7)
18 _invoke2 (dart:ui/hooks.dart:176:10)
19 _ChannelCallbackRecord.invoke (dart:ui/channel_buffers.dart:40:5)
20 _Channel.push (dart:ui/channel_buffers.dart:130:31)
21 ChannelBuffers.push (dart:ui/channel_buffers.dart:326:17)
22 PlatformDispatcher._dispatchPlatformMessage (dart:ui/platform_dispatcher.dart:686:22)
23 _dispatchPlatformMessage (dart:ui/hooks.dart:86:31)
2
════════ Exception caught by services library ══════════════════════════════════ 'package:flutter_quill/src/models/documents/nodes/container.dart': Failed assertion: line 123 pos 12: 'index == 0 || (index > 0 && index < length)': is not true.
Flutter Doctor
[✓] Flutter (Channel stable, 3.10.6, on macOS 12.6 21G115 darwin-arm64, locale en-AU) • Flutter version 3.10.6 on channel stable at /Users/caco/Development/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision f468f3366c (4 weeks ago), 2023-07-12 15:19:05 -0700 • Engine revision cdbeda788a • Dart version 3.0.6 • DevTools version 2.23.1
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0) • Android SDK at /Users/caco/Library/Android/sdk • Platform android-33, build-tools 33.0.0 • ANDROID_HOME = /Users/caco/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) • All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.2) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14C18 • CocoaPods version 1.11.3
[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.2) • Android Studio at /Applications/Android Studio.app/Contents • 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 11.0.12+0-b1504.28-7817840)
[✓] VS Code (version 1.80.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.70.0
[✓] Connected device (5 available) • SM A217F (mobile) • RF8R51DXW4L • android-arm64 • Android 12 (API 31) • iPhone (mobile) • 26c572951929f1725c51ca6a99108845355576d3 • ios • iOS 16.3.1 20D67 • iPhone 11 (mobile) • 00008030-00016CC60C90802E • ios • iOS 16.5.1 20F75 • macOS (desktop) • macos • darwin-arm64 • macOS 12.6 21G115 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 115.0.5790.170
[✓] Network resources • All expected network resources are available.
• No issues found!