-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
r: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Description
Steps to Reproduce
Started occurring when upgraded to Flutter 3.3.x
This is how I reproduce it in my app:
- Focus into text input box
- Press a submit button that removes the text input box from the widget tree
- Error appears in console.
Range Start XX is out of text of length 0, whereXXis whatever the cursor position was before the text inbox is removed form the widget tree.
Expected results:
Actual results:
Code sample
Logs
══╡ EXCEPTION CAUGHT BY FOUNDATION LIBRARY
╞════════════════════════════════════════════════════════
The following assertion was thrown while dispatching notifications for
TextEditingControllerWithCursorPosition:
Range start 39 is out of text of length 0
'package:flutter/src/services/text_input.dart':
Failed assertion: line 968 pos 12: 'range.start >= 0 && range.start <=
text.length'
Either the assertion indicates an error in the framework itself, or we should
provide
substantially
more information in this error message to help you determine and fix the
underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=2_bug.md
When the exception was thrown, this was the stack:
#2 TextEditingValue._textRangeIsValid
(package:flutter/src/services/text_input.dart:968:12)
#3 TextEditingValue.toJSON
(package:flutter/src/services/text_input.dart:923:12)
#4 TextInput._setEditingState
(package:flutter/src/services/text_input.dart:1889:13)
#5 TextInputConnection.setEditingState
(package:flutter/src/services/text_input.dart:1336:25)
#6 EditableTextState._updateRemoteEditingValueIfNeeded
(package:flutter/src/widgets/editable_text.dart:2347:27)
#7 EditableTextState._didChangeTextEditingValue
(package:flutter/src/widgets/editable_text.dart:2880:5)
#8 ChangeNotifier.notifyListeners
(package:flutter/src/foundation/change_notifier.dart:351:24)
#9 ValueNotifier.value=
(package:flutter/src/foundation/change_notifier.dart:456:5)
#10 TextEditingController.value=
(package:flutter/src/widgets/editable_text.dart:156:11)
#11 TextEditingControllerWithCursorPosition.text=
(package:app/widgets/forms/text_editing_controller_with_cursor.dart:8:5)
#12 _TextModeBarState._send.<anonymous closure>
(package:app/screens/chat_detail/text/text_mode_bar.dart:84:25)
#13 State.setState (package:flutter/src/widgets/framework.dart:1114:30)
#14 _TextModeBarState._send
(package:app/screens/chat_detail/text/text_mode_bar.dart:83:7)
#15 _InkResponseState.handleTap
(package:flutter/src/material/ink_well.dart:1072:21)
#16 GestureRecognizer.invokeCallback
(package:flutter/src/gestures/recognizer.dart:253:24)
#17 TapGestureRecognizer.handleTapUp
(package:flutter/src/gestures/tap.dart:627:11)
#18 BaseTapGestureRecognizer._checkUp
(package:flutter/src/gestures/tap.dart:306:5)
#19 BaseTapGestureRecognizer.acceptGesture
(package:flutter/src/gestures/tap.dart:276:7)
#20 GestureArenaManager.sweep
(package:flutter/src/gestures/arena.dart:163:27)
#21 GestureBinding.handleEvent
(package:flutter/src/gestures/binding.dart:464:20)
#22 GestureBinding.dispatchEvent
(package:flutter/src/gestures/binding.dart:440:22)
#23 RendererBinding.dispatchEvent
(package:flutter/src/rendering/binding.dart:337:11)
#24 GestureBinding._handlePointerEventImmediately
(package:flutter/src/gestures/binding.dart:395:7)
#25 GestureBinding.handlePointerEvent
(package:flutter/src/gestures/binding.dart:357:5)
#26 GestureBinding._flushPointerEventQueue
(package:flutter/src/gestures/binding.dart:314:7)
#27 GestureBinding._handlePointerDataPacket
(package:flutter/src/gestures/binding.dart:295:7)
#31 _invoke1 (dart:ui/hooks.dart:169:10)
#32 PlatformDispatcher._dispatchPointerDataPacket
(dart:ui/platform_dispatcher.dart:341:7)
#33 _dispatchPointerDataPacket (dart:ui/hooks.dart:94:31)
(elided 5 frames from class _AssertionError and dart:async)
The TextEditingControllerWithCursorPosition sending notification was:
TextEditingControllerWithCursorPosition#6a129(TextEditingValue(text: ┤├,
selection:
TextSelection.collapsed(offset: 39, affinity: TextAffinity.downstream,
isDirectional: false),
composing: TextRange(start: -1, end: -1)))
Analyzing app...
info • 'Future.value' shouldn't be called with a null argument for the non-nullable type argument
'UploadResult' • lib/services/storage.dart:33:27 • null_argument_to_non_null_type
[✓] Flutter (Channel stable, 3.3.2, on macOS 12.5.1 21G83 darwin-arm, locale en-US)
• Flutter version 3.3.2 on channel stable at /Users/erica/dev/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision e3c29ec00c (5 days ago), 2022-09-14 08:46:55 -0500
• Engine revision a4ff2c53d8
• Dart version 2.18.1
• DevTools version 2.15.0
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 13C100
• CocoaPods version 1.11.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
[✓] VS Code (version 1.71.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.48.0
[✓] Connected device (3 available)
• Jen’s Old iPhone 7 (mobile) • 60d15d94cd727467d0e36789c68aa5beac3b62ca • ios • iOS 15.6.1
19G82
• macOS (desktop) • macos • darwin-arm64 • macOS 12.5.1
21G83 darwin-arm
• Chrome (web) • chrome • web-javascript • Google Chrome
105.0.5195.125
[✓] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 2 categories.
Metadata
Metadata
Assignees
Labels
r: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version