Skip to content

mouse_tracking.dart failed assertion #64129

Closed

Description

@chipkent

Steps to Reproduce

I do not have a compact reproducer. The code that seems to trigger the problem looks like:

class LMPredPage extends ScaffoldWidget {
  const LMPredPage({Key key}) : super('LM Preds', key: key);

  @override
  Widget body(BuildContext context) {
    return ListView(
      children: [
        SingleChildScrollView(
          scrollDirection: Axis.horizontal,
          child: ...,
        )
      ]
    );
  }
}

The problem is observed when doing a hot reload in debug mode on Android Studio with a macOS target.

Expected results:

No assertions.

Actual results:

Logs

════════ Exception caught by gesture library ═══════════════════════════════════════════════════════
The following assertion was thrown while routing a pointer event:
'package:flutter/src/rendering/mouse_tracking.dart': Failed assertion: line 392 pos 12: '!_debugDuringDeviceUpdate': 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=BUG.md

When the exception was thrown, this was the stack:
#2 BaseMouseTracker._deviceUpdatePhase (package:flutter/src/rendering/mouse_tracking.dart:392:12)
#3 BaseMouseTracker._handleEvent. (package:flutter/src/rendering/mouse_tracking.dart:477:7)
#4 BaseMouseTracker._monitorMouseConnection (package:flutter/src/rendering/mouse_tracking.dart:381:9)
#5 BaseMouseTracker._handleEvent (package:flutter/src/rendering/mouse_tracking.dart:476:5)
#6 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:77:12)

flutter doctor -v
[✓] Flutter (Channel dev, 1.21.0-9.0.pre, on Mac OS X 10.15.4 19E287, locale en-US)
• Flutter version 1.21.0-9.0.pre at /Users/chip/dev/flutter
• Framework revision 7c6f9dd (10 days ago), 2020-08-09 10:31:03 -0400
• Engine revision 6d86e67
• Dart version 2.10.0 (build 2.10.0-4.0.dev 0341576448)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /Users/chip/Library/Android/sdk/
• Platform android-29, build-tools 29.0.3
• ANDROID_HOME = /Applications/android-sdks/
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.6)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.6, Build version 11E708
• CocoaPods version 1.9.1

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

[✓] Android Studio (version 3.6)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 45.1.1
• Dart plugin version 192.8052
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[!] VS Code (version 1.45.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
✗ Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (3 available)
• macOS (desktop) • macos • darwin-x64 • Mac OS X 10.15.4 19E287
• Web Server (web) • web-server • web-javascript • Flutter Tools
• Chrome (web) • chrome • web-javascript • Google Chrome 84.0.4147.125

! Doctor found issues in 1 category.

Activity

  1. pedromassangocode commented on Aug 19, 2020

    @pedromassangocode

    Hi @chipkent
    Does the code bellow reproduce the issue for you?

    sample code
    import 'package:flutter/material.dart';
    
    void main() => runApp(MyApp());
    
    class MyApp extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          title: 'Flutter Demo',
          home: Scaffold(
            appBar: AppBar(
              title: Text('Label unnecessarily elided'),
            ),
            body: ListView(
                children: [
                  SingleChildScrollView(
                    scrollDirection: Axis.horizontal,
                  )
                ]
            ),
          ),
        );
      }
    }
    
  2. added
    in triagePresently being triaged by the triage team
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Aug 19, 2020
  3. chipkent commented on Aug 31, 2020

    @chipkent
    Author

    Sorry for the delay. This did not reproduce the problem.

  4. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Aug 31, 2020
  5. pedromassangocode commented on Aug 31, 2020

    @pedromassangocode

    Hi @chipkent
    I cannot reproduce this issue on latest dev channel.
    Can you upgrade to master and try again
    flutter channel master
    flutter upgrade --force
    flutter doctor -v

  6. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Aug 31, 2020
  7. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Oct 14, 2020
  8. TahaTesser commented on Oct 14, 2020

    @TahaTesser
    Contributor

    Without additional information, we are unfortunately not sure how to resolve this issue.
    We are therefore reluctantly going to close this bug for now.
    Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away!
    Thanks for your contribution.

  9. oakstair commented on Oct 31, 2020

    @oakstair

    We are phasing the same issue in a web project using the latest stable channel. We did start to get these errors after last stable release.

    Unfortunately at this moment we do not have a minimal project to share.

    ════════ Exception caught by scheduler library ═════════════════════════════════════════════════════ Assertion failed: file:///Users/gunnar/dev/flutter/packages/flutter/lib/src/rendering/mouse_tracking.dart:301:12 !_debugDuringDeviceUpdate is not true

    I guess using master is not an option for a web project :-(

    `
    gunnar@iMac aemee-flutter-poc % flutter devices
    2 connected devices:

    Web Server (web) • web-server • web-javascript • Flutter Tools
    Chrome (web) • chrome • web-javascript • Google Chrome 86.0.4240.111
    gunnar@iMac aemee-flutter-poc % flutter doctor
    Doctor summary (to see all details, run flutter doctor -v):
    [✓] Flutter (Channel beta, 1.23.0-18.1.pre, on Mac OS X 10.15.7 19H2 x86_64, locale sv-SE)
    [!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    ✗ Android license status unknown.
    Run flutter doctor --android-licenses to accept the SDK licenses.
    See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
    [✓] Xcode - develop for iOS and macOS (Xcode 12.1)
    [✓] Chrome - develop for the web
    [✓] Android Studio (version 4.1)
    [✓] IntelliJ IDEA Ultimate Edition (version 2020.2.3)
    [✓] Connected device (2 available)

    ! Doctor found issues in 1 category.

    `

  10. oakstair commented on Oct 31, 2020

    @oakstair

    Uploading Skärmavbild 2020-10-31 kl. 07.48.09.png…

  11. TahaTesser commented on Nov 2, 2020

    @TahaTesser
    Contributor

    Could everyone who still has this problem please file a new issue with the exact description of what happens, logs, and the output of flutter doctor -v.
    All system setups can be slightly different, so it's always better to open new issues and reference related issues.

  12. oakstair commented on Nov 2, 2020

    @oakstair

    This is what our developer who has now coded around this bug stated:

    In the latets flutter version, inkwell can not be dragged with an effect (onTap, onHover, onLongPressed)

  13. SethKitchen commented on Dec 8, 2020

    @SethKitchen

    Same error with InkWell -- weird it doesn't care about directionality until a random drag time. I Tried to wrap my App with Directionality but it doesn't work.

    errors.dart:167 Uncaught Error: No Directionality widget found.
    _InkResponseStateWidget widgets require a Directionality widget ancestor.
    The specific widget that could not find a Directionality ancestor was:
    _InkResponseStateWidget
    The ownership chain for the affected widget is: "_InkResponseStateWidget ← InkWell ← Semantics ← DefaultTextStyle ← AnimatedDefaultTextStyle ← _InkFeatures-[GlobalKey#bc79c ink renderer] ← NotificationListener ← CustomPaint ← ShapeBorderPaint ← PhysicalShape ← ⋯"
    Typically, the Directionality widget is introduced by the MaterialApp or WidgetsApp widget at the top of your application widget tree. It determines the ambient reading direction and is used, for example, to determine how to lay out text, how to interpret "start" and "end" values, and to resolve EdgeInsetsDirectional, AlignmentDirectional, and other *Directional objects.
    at Object.throw [as throw] (errors.dart:216)
    at debug.dart:271
    at Object.debugCheckHasDirectionality (debug.dart:290)
    at Function.of (basic.dart:117)
    at ink_well._InkResponseState.new.updateHighlight (ink_well.dart:850)
    at ink_well._InkResponseState.new.[_handleHoverChange] (ink_well.dart:1059)
    at ink_well._InkResponseState.new.[_handleMouseEnter] (ink_well.dart:1047)
    at Function._handleDeviceUpdateMouseEvents (mouse_tracking.dart:502)
    at mouse_tracking.MouseTracker.new.handleDeviceUpdate (mouse_tracking.dart:510)
    at mouse_tracking.dart:428
    at mouse_tracking.MouseTracker.new.[_deviceUpdatePhase] (mouse_tracking.dart:306)
    at mouse_tracking.dart:408
    at mouse_tracking.MouseTracker.new.[_monitorMouseConnection] (mouse_tracking.dart:290)
    at mouse_tracking.MouseTracker.new.updateWithEvent (mouse_tracking.dart:407)
    at binding$5.WidgetsFlutterBinding.new.dispatchEvent (binding.dart:276)
    at binding$5.WidgetsFlutterBinding.new.[_handlePointerEventImmediately] (binding.dart:316)
    at binding$5.WidgetsFlutterBinding.new.handlePointerEvent (binding.dart:280)
    at binding$5.WidgetsFlutterBinding.new.[_flushPointerEventQueue] (binding.dart:238)
    at binding$5.WidgetsFlutterBinding.new.[_handlePointerDataPacket] (binding.dart:221)
    at Object.invoke1 (platform_dispatcher.dart:907)
    at _engine.EnginePlatformDispatcher..invokeOnPointerDataPacket (platform_dispatcher.dart:170)
    at _engine.PointerBinding..[onPointerData] (pointer_binding.dart:128)
    at pointer_binding.dart:513
    at pointer_binding.dart:485
    at pointer_binding.dart:208
    DartError @ errors.dart:167
    throw @ errors.dart:216
    (anonymous) @ debug.dart:271
    debugCheckHasDirectionality @ debug.dart:290
    of @ basic.dart:117
    updateHighlight @ ink_well.dart:850
    [_handleHoverChange] @ ink_well.dart:1059
    [_handleMouseEnter] @ ink_well.dart:1047
    _handleDeviceUpdateMouseEvents @ mouse_tracking.dart:502
    handleDeviceUpdate @ mouse_tracking.dart:510
    (anonymous) @ mouse_tracking.dart:428
    [_deviceUpdatePhase] @ mouse_tracking.dart:306
    (anonymous) @ mouse_tracking.dart:408
    [_monitorMouseConnection] @ mouse_tracking.dart:290
    updateWithEvent @ mouse_tracking.dart:407
    dispatchEvent @ binding.dart:276
    [_handlePointerEventImmediately] @ binding.dart:316
    handlePointerEvent @ binding.dart:280
    [_flushPointerEventQueue] @ binding.dart:238
    [_handlePointerDataPacket] @ binding.dart:221
    invoke1 @ platform_dispatcher.dart:907
    invokeOnPointerDataPacket @ platform_dispatcher.dart:170
    [_onPointerData] @ pointer_binding.dart:128
    (anonymous) @ pointer_binding.dart:513
    (anonymous) @ pointer_binding.dart:485
    (anonymous) @ pointer_binding.dart:208
    32errors.dart:167 Uncaught Error: Assertion failed: file:///D:/git/flutter/packages/flutter/lib/src/rendering/mouse_tracking.dart:301:12
    !debugDuringDeviceUpdate
    is not true
    at Object.throw [as throw] (errors.dart:216)
    at Object.assertFailed (errors.dart:24)
    at mouse_tracking.MouseTracker.new.[_deviceUpdatePhase] (mouse_tracking.dart:301)
    at mouse_tracking.dart:408
    at mouse_tracking.MouseTracker.new.[_monitorMouseConnection] (mouse_tracking.dart:290)
    at mouse_tracking.MouseTracker.new.updateWithEvent (mouse_tracking.dart:407)
    at binding$5.WidgetsFlutterBinding.new.dispatchEvent (binding.dart:276)
    at binding$5.WidgetsFlutterBinding.new.[_handlePointerEventImmediately] (binding.dart:316)
    at binding$5.WidgetsFlutterBinding.new.handlePointerEvent (binding.dart:280)
    at binding$5.WidgetsFlutterBinding.new.[_flushPointerEventQueue] (binding.dart:238)
    at binding$5.WidgetsFlutterBinding.new.[_handlePointerDataPacket] (binding.dart:221)
    at Object.invoke1 (platform_dispatcher.dart:907)
    at _engine.EnginePlatformDispatcher..invokeOnPointerDataPacket (platform_dispatcher.dart:170)
    at _engine.PointerBinding..[_onPointerData] (pointer_binding.dart:128)
    at pointer_binding.dart:513
    at pointer_binding.dart:485
    at pointer_binding.dart:208

  14. TahaTesser commented on Dec 9, 2020

    @TahaTesser
    Contributor

    Could everyone who still has this problem please file a new issue with the exact description of what happens, logs, and the output of flutter doctor -v.
    All system setups can be slightly different, so it's always better to open new issues and reference related issues.

  15. github-actions commented on Aug 9, 2021

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

  16. locked as resolved and limited conversation to collaborators on Aug 9, 2021
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

    in triagePresently being triaged by the triage team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions