Skip to content

Failed assertion: line 1017 pos 14: '_dragState == _DragState.possible': is not true. #153458

Closed

Description

@siddharthadevops

Steps to reproduce

  1. Insert example code in a Flutter App for iOS.
  2. Debug in an actual device.
  3. Paste some text into the TextField with more than 5 lines.
  4. Double-tap to select a word.
  5. Swipe outside the selection (the word will remain highlighted without the handles).
  6. Tap on the selected word.

Expected results

TextField should process tap gestures on iOS devices.

Actual results

The text field stops processing the tap gesture and also exhibits erratic and unpredictable behavior after the assert condition occurs.

Code sample

Code sample
             const TextField(
                maxLines: 5,
              )

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
======== Exception caught by gesture library =======================================================
The following assertion was thrown while dispatching a pointer event:
'package:flutter/src/gestures/tap_and_drag.dart': Failed assertion: line 1017 pos 14: '_dragState == _DragState.possible': is not true.


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.yml

When the exception was thrown, this was the stack: 
#2      BaseTapAndDragGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap_and_drag.dart:1017:14)
#3      GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:169:27)
#4      GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:505:20)
#5      GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:481:22)
#6      RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:450:11)
#7      GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:426:7)
#8      GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:389:5)
#9      GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:336:7)
#10     GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:305:9)
#11     _invoke1 (dart:ui/hooks.dart:328:13)
#12     PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:442:7)
#13     _dispatchPointerDataPacket (dart:ui/hooks.dart:262:31)
(elided 2 frames from class _AssertionError)
Event: PointerUpEvent#2585a(position: Offset(155.3, 331.0))
  position: Offset(155.3, 331.0)
Target: <WidgetsFlutterBinding>
====================================================================================================

Flutter Doctor output

Doctor output
[!] Flutter (Channel stable, 3.24.0, on macOS 14.5 23F79 darwin-arm64, locale en-ES)
    • Flutter version 3.24.0 on channel stable at /users/siddhartha/development/flutter
    ! Warning: `flutter` on your path resolves to /Users/siddhartha/Development/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /users/siddhartha/development/flutter.
      Consider adding /users/siddhartha/development/flutter/bin to the front of your path.
    ! Warning: `dart` on your path resolves to /Users/siddhartha/Development/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /users/siddhartha/development/flutter.
      Consider adding /users/siddhartha/development/flutter/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 80c2e84975 (2 weeks ago), 2024-07-30 23:06:49 +0700
    • Engine revision b8800d88be
    • Dart version 3.5.0
    • DevTools version 2.37.2
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/siddhartha/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.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 17.0.9+0-17.0.9b1087.7-11185874)

[✓] IntelliJ IDEA Community Edition (version 2024.1.6)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 81.0.2
    • Dart plugin version 241.18968.26

[✓] VS Code (version 1.92.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.94.0

[✓] Connected device (7 available)
    • Pixel 6a (mobile)               • 29261JEGR09487                       • android-arm64  • Android 14 (API 34)
    • CPH2161 (mobile)                • NF6HPBY98LXGHM99                     • android-arm64  • Android 12 (API 31)
    • iPhone de Dante (mobile)        • 00008120-00062D983CC0C01E            • ios            • iOS 18.0 22A5338b
    • iPhone 15 Pro Max (mobile)      • 905EEE9E-8306-4379-9F60-3E96872FC350 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-17-4 (simulator)
    • macOS (desktop)                 • macos                                • darwin-arm64   • macOS 14.5 23F79 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad                • darwin         • macOS 14.5 23F79 darwin-arm64
    • Chrome (web)                    • chrome                               • web-javascript • Google Chrome 127.0.6533.100
    ! Error: Browsing on the local area network for iPhone 14 de Ryo . Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

Activity

  1. added
    in triagePresently being triaged by the triage team
    on Aug 15, 2024
  2. huycozy commented on Aug 15, 2024

    @huycozy
    Member

    Thanks for the report, @siddharthadevops
    I can reproduce this issue on Flutter stable 3.24.0 but don't see it appear on master channel 3.24.0-1.0.pre.591. Can you please confirm this on master channel on your end?

  3. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Aug 15, 2024
  4. siddharthadevops commented on Aug 15, 2024

    @siddharthadevops
    Author

    @huycozy yes, I have been able to reproduce this bug also on master channel:

    ======== Exception caught by gesture library =======================================================
    The following assertion was thrown while dispatching a pointer event:
    'package:flutter/src/gestures/tap_and_drag.dart': Failed assertion: line 1012 pos 14: '_dragState == _DragState.possible': is not true.
    
    
    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.yml
    
    When the exception was thrown, this was the stack: 
    #2      BaseTapAndDragGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap_and_drag.dart:1012:14)
    #3      GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:167:27)
    #4      GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:499:20)
    #5      GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:475:22)
    #6      RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:450:11)
    #7      GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:420:7)
    #8      GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:383:5)
    #9      GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:330:7)
    #10     GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:299:9)
    #11     _invoke1 (dart:ui/hooks.dart:328:13)
    #12     PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:442:7)
    #13     _dispatchPointerDataPacket (dart:ui/hooks.dart:262:31)
    (elided 2 frames from class _AssertionError)
    Event: PointerUpEvent#0947b(position: Offset(145.0, 322.7))
      position: Offset(145.0, 322.7)
    Target: <WidgetsFlutterBinding>
    ====================================================================================================
    
  5. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Aug 15, 2024
  6. huycozy commented on Aug 16, 2024

    @huycozy
    Member

    Can you take a look at my demo video to see if I missed any steps to reproduce this error? I'm on the latest master 3.24.0-1.0.pre.605.

    Demo
    Screen.Recording.2024-08-16.at.11.57.43.mov
  7. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Aug 16, 2024
  8. siddharthadevops commented on Aug 16, 2024

    @siddharthadevops
    Author

    Sorry @huycozy, I didn't have the master channel updated to the latest version. I thought I had updated it along with the stable version.
    Once updated, I have not been able to reproduce this bug in the master channel.

  9. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Aug 16, 2024
  10. huycozy commented on Aug 16, 2024

    @huycozy
    Member

    Thank you for confirming this. Closing this as fixed on master channel.

  11. added
    r: fixedIssue is closed as already fixed in a newer version
    and removed
    in triagePresently being triaged by the triage team
    on Aug 16, 2024
  12. Adam-Langley commented on Aug 21, 2024

    @Adam-Langley

    Thanks @huycozy - is there documentation on how I can determine when this is likely to land in stable? This one is biting our power users - they swipe about so quickly in our app, this bug is triggered often, rendering the UI unusable - so I'd like to be able to at minimum give them a timeline to resolution.

  13. siddharthadevops commented on Aug 21, 2024

    @siddharthadevops
    Author

    I think this issue should be prioritized. Every time the user tries to edit a text by selecting, cutting, pasting, etc., it is highly likely that this error will occur.

  14. 5 remaining items

  15. added
    f: gesturesflutter/packages/flutter/gestures repository.
    platform-iosiOS applications specifically
    a: error messageError messages from the Flutter framework
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    on Aug 21, 2024
  16. Renzo-Olivares commented on Aug 21, 2024

    @Renzo-Olivares
    Contributor

    @huycozy Thanks for letting me know, I'll try to CP this in.

  17. added
    P2Important issues not at the top of the work list
    on Aug 22, 2024
  18. Renzo-Olivares commented on Sep 30, 2024

    @Renzo-Olivares
    Contributor

    Closing this because the cherry-pick was merged into stable #153935.

  19. added
    r: fixedIssue is closed as already fixed in a newer version
    on Oct 1, 2024
  20. github-actions commented on Oct 15, 2024

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  21. locked as resolved and limited conversation to collaborators on Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: error messageError messages from the Flutter frameworka: text inputEntering text in a text field or keyboard related problemsf: gesturesflutter/packages/flutter/gestures repository.found in release: 3.24Found to occur in 3.24frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-iosiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-text-inputOwned by Text Input teamtriaged-text-inputTriaged by Text Input team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions