solid-software/languagetool_textfield

Bug: RangeError

Closed this issue · 0 comments

image

Rough steps to reproduce:

  • write a piece of text with at least one mistake in it,
  • paste it into the field multiple times at random.
  • At some point you'll get a red screen with RenderOverflow, but the undelying error is in logs below.
Logs
======== Exception caught by widgets library =======================================================
The following RangeError was thrown building Scrollable-[GlobalKey#b650c](axisDirection: right, physics: null, restorationId: "editable", dependencies: [MediaQuery, UnmanagedRestorationScope, _InheritedTheme, _LocalizationsScope-[GlobalKey#fd61a]], state: ScrollableState#eb19e(tickers: tracking 0 tickers, position: ScrollPositionWithSingleContext#2d44b(offset: 0.0, range: 0.0..4377.0, viewport: 452.0, ScrollableState, BouncingScrollPhysics -> RangeMaintainingScrollPhysics -> BouncingScrollPhysics -> RangeMaintainingScrollPhysics, IdleScrollActivity#415cd, ScrollDirection.idle), effective physics: BouncingScrollPhysics -> RangeMaintainingScrollPhysics -> BouncingScrollPhysics -> RangeMaintainingScrollPhysics)):
RangeError (end): Invalid value: Not in inclusive range 354..660: 55

The relevant error-causing widget was: 
  TextField TextField:file:///Users/yuriiprykhodko/dev/projects/solid/languagetool_textfield/lib/presentation/language_tool_text_field.dart:81:20
When the exception was thrown, this was the stack: 
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 288:49                  throw_
dart-sdk/lib/core/errors.dart 365:9                                                           checkValidRange
dart-sdk/lib/_internal/js_dev_runtime/private/js_string.dart 169:22                           substring]
packages/languagetool_textfield/core/controllers/colored_text_editing_controller.dart 139:20  _generateSpans
dart-sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart 555:14                            of
dart-sdk/lib/core/iterable.dart 494:7                                                         toList
packages/languagetool_textfield/core/controllers/colored_text_editing_controller.dart 72:35   buildTextSpan
packages/flutter/src/widgets/editable_text.dart 4684:30                                       buildTextSpan
packages/flutter/src/widgets/editable_text.dart 4568:41                                       <fn>
packages/flutter/src/widgets/scrollable.dart 888:44                                           build
packages/flutter/src/widgets/framework.dart 5198:27                                           build
packages/flutter/src/widgets/framework.dart 5086:15                                           performRebuild
packages/flutter/src/widgets/framework.dart 5251:11                                           performRebuild
packages/flutter/src/widgets/framework.dart 4805:7                                            rebuild
packages/flutter/src/widgets/framework.dart 5274:5                                            update
packages/flutter/src/widgets/framework.dart 3686:14                                           updateChild
packages/flutter/src/widgets/framework.dart 5111:16                                           performRebuild
packages/flutter/src/widgets/framework.dart 4805:7                                            rebuild
packages/flutter/src/widgets/framework.dart 5417:5                                            update
packages/flutter/src/widgets/inherited_notifier.dart 107:11                                   update
packages/flutter/src/widgets/framework.dart 3686:14                                           updateChild
packages/flutter/src/widgets/framework.dart 5111:16                                           performRebuild
packages/flutter/src/widgets/framework.dart 5251:11                                           performRebuild
packages/flutter/src/widgets/framework.dart 4805:7                                            rebuild
packages/flutter/src/widgets/framework.dart 5274:5                                            update
packages/flutter/src/widgets/framework.dart 3686:14                                           updateChild
packages/flutter/src/widgets/framework.dart 5111:16                                           performRebuild
packages/flutter/src/widgets/framework.dart 4805:7                                            rebuild
packages/flutter/src/widgets/framework.dart 5417:5                                            update
packages/flutter/src/widgets/framework.dart 3686:14                                           updateChild
packages/flutter/src/widgets/framework.dart 5111:16                                           performRebuild
packages/flutter/src/widgets/framework.dart 5251:11                                           performRebuild
packages/flutter/src/widgets/framework.dart 4805:7                                            rebuild
packages/flutter/src/widgets/framework.dart 5274:5                                            update
packages/flutter/src/widgets/framework.dart 3686:14                                           updateChild
packages/flutter/src/widgets/framework.dart 5111:16                                           performRebuild
packages/flutter/src/widgets/framework.dart 5251:11                                           performRebuild
packages/flutter/src/widgets/framework.dart 4805:7                                            rebuild
packages/flutter/src/widgets/framework.dart 5274:5                                            update
packages/flutter/src/widgets/framework.dart 3686:14                                           updateChild
packages/flutter/src/widgets/framework.dart 5111:16                                           performRebuild
packages/flutter/src/widgets/framework.dart 4805:7                                            rebuild
packages/flutter/src/widgets/framework.dart 5417:5                                            update
packages/flutter/src/widgets/framework.dart 3686:14                                           updateChild
packages/flutter/src/widgets/framework.dart 5111:16                                           performRebuild
packages/flutter/src/widgets/framework.dart 5251:11                                           performRebuild
packages/flutter/src/widgets/framework.dart 4805:7                                            rebuild
packages/flutter/src/widgets/framework.dart 5274:5                                            update
packages/flutter/src/widgets/framework.dart 3686:14                                           updateChild
packages/flutter/src/widgets/framework.dart 6442:14                                           update
packages/flutter/src/widgets/framework.dart 3686:14                                           updateChild
packages/flutter/src/widgets/framework.dart 6442:14                                           update
packages/flutter/src/widgets/framework.dart 3686:14                                           updateChild
packages/flutter/src/widgets/framework.dart 6442:14                                           update
packages/flutter/src/widgets/framework.dart 3686:14                                           updateChild
packages/flutter/src/widgets/framework.dart 5111:16                                           performRebuild
packages/flutter/src/widgets/framework.dart 5251:11                                           performRebuild
packages/flutter/src/widgets/framework.dart 4805:7                                            rebuild
packages/flutter/src/widgets/framework.dart 5274:5                                            update
packages/flutter/src/widgets/framework.dart 3686:14                                           updateChild
packages/flutter/src/widgets/framework.dart 5111:16                                           performRebuild
packages/flutter/src/widgets/framework.dart 4805:7                                            rebuild
packages/flutter/src/widgets/framework.dart 5417:5                                            update
packages/flutter/src/widgets/framework.dart 3686:14                                           updateChild
packages/flutter/src/widgets/framework.dart 6442:14                                           update
packages/flutter/src/widgets/framework.dart 3686:14                                           updateChild
packages/flutter/src/widgets/slotted_render_object_widget.dart 270:33                         [_updateChildren]
packages/flutter/src/widgets/slotted_render_object_widget.dart 231:5                          update
packages/flutter/src/widgets/framework.dart 3686:14                                           updateChild
packages/flutter/src/widgets/framework.dart 5111:16                                           performRebuild
packages/flutter/src/widgets/framework.dart 5251:11                                           performRebuild
packages/flutter/src/widgets/framework.dart 4805:7                                            rebuild
packages/flutter/src/widgets/framework.dart 5274:5                                            update
packages/flutter/src/widgets/framework.dart 3686:14                                           updateChild
packages/flutter/src/widgets/framework.dart 5111:16                                           performRebuild
packages/flutter/src/widgets/framework.dart 5251:11                                           performRebuild
packages/flutter/src/widgets/framework.dart 4805:7                                            rebuild
packages/flutter/src/widgets/framework.dart 5274:5                                            update
packages/flutter/src/widgets/framework.dart 3686:14                                           updateChild
packages/flutter/src/widgets/framework.dart 6442:14                                           update
packages/flutter/src/widgets/framework.dart 3686:14                                           updateChild
packages/flutter/src/widgets/framework.dart 5111:16                                           performRebuild
packages/flutter/src/widgets/framework.dart 5251:11                                           performRebuild
packages/flutter/src/widgets/framework.dart 4805:7                                            rebuild
packages/flutter/src/widgets/framework.dart 5274:5                                            update
packages/flutter/src/widgets/framework.dart 3686:14                                           updateChild
packages/flutter/src/widgets/framework.dart 5111:16                                           performRebuild
packages/flutter/src/widgets/framework.dart 5251:11                                           performRebuild
packages/flutter/src/widgets/framework.dart 4805:7                                            rebuild
packages/flutter/src/widgets/framework.dart 5274:5                                            update
packages/flutter/src/widgets/framework.dart 3686:14                                           updateChild
packages/flutter/src/widgets/framework.dart 6442:14                                           update
packages/flutter/src/widgets/framework.dart 3686:14                                           updateChild
packages/flutter/src/widgets/framework.dart 5111:16                                           performRebuild
packages/flutter/src/widgets/framework.dart 5251:11                                           performRebuild
packages/flutter/src/widgets/framework.dart 4805:7                                            rebuild
packages/flutter/src/widgets/framework.dart 5274:5                                            update
packages/flutter/src/widgets/framework.dart 3686:14                                           updateChild
packages/flutter/src/widgets/framework.dart 6442:14                                           update
packages/flutter/src/widgets/framework.dart 3686:14                                           updateChild
packages/flutter/src/widgets/framework.dart 6442:14                                           update
packages/flutter/src/widgets/framework.dart 3686:14                                           updateChild
packages/flutter/src/widgets/framework.dart 6442:14                                           update
packages/flutter/src/widgets/framework.dart 3686:14                                           updateChild
packages/flutter/src/widgets/framework.dart 5111:16                                           performRebuild
packages/flutter/src/widgets/framework.dart 5251:11                                           performRebuild
packages/flutter/src/widgets/framework.dart 4805:7                                            rebuild
packages/flutter/src/widgets/framework.dart 5274:5                                            update
packages/flutter/src/widgets/framework.dart 3686:14                                           updateChild
packages/flutter/src/widgets/framework.dart 6442:14                                           update
packages/flutter/src/widgets/framework.dart 3686:14                                           updateChild
packages/flutter/src/widgets/framework.dart 6442:14                                           update
packages/flutter/src/widgets/framework.dart 3686:14                                           updateChild
packages/flutter/src/widgets/framework.dart 5111:16                                           performRebuild
packages/flutter/src/widgets/framework.dart 5251:11                                           performRebuild
packages/flutter/src/widgets/framework.dart 4805:7                                            rebuild
packages/flutter/src/widgets/framework.dart 2780:18                                           buildScope
packages/flutter/src/widgets/binding.dart 903:9                                               drawFrame
packages/flutter/src/rendering/binding.dart 358:5                                             [_handlePersistentFrameCallback]
packages/flutter/src/scheduler/binding.dart 1284:15                                           [_invokeFrameCallback]
packages/flutter/src/scheduler/binding.dart 1214:9                                            handleDrawFrame
packages/flutter/src/scheduler/binding.dart 1072:5                                            [_handleDrawFrame]
lib/_engine/engine/platform_dispatcher.dart 1236:13                                           invoke
lib/_engine/engine/platform_dispatcher.dart 244:5                                             invokeOnDrawFrame
lib/_engine/engine/initialization.dart 190:45                                                 <fn>
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 367:37              _checkAndCall
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 372:39              dcall
====================================================================================================

======== Exception caught by rendering library =====================================================
The following assertion was thrown during layout:
A RenderFlex overflowed by 99434 pixels on the bottom.

This maps to this code in my particular case:
image
https://github.com/solid-software/languagetool_textfield/blob/main/lib/core/controllers/colored_text_editing_controller.dart#L122