Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Three finger screenshotting throws assert #20517
On our released version of App, we were notified with an exception as the title show, the detail track infos are as follow:
NoSuchMethodError: The getter 'lastPosition' was called on null.
That's the full exception stack, from where I cannot get any info where my code got wrong because it's all about the framework layer, and I'm not very familiar with this layer.I did not found anything invoke the function _dispatchPointerDataPacket in hooks.dart from my code.
I can reproduce this in a release build, when tapping anywhere with 3 fingers. It does not crash when tapping with 1 or 2 fingers.
Update: Seems that its crashing on a OnePlus 5, but not on a Xiaomi A2.
My guess would be that some Android device is sending us bogus data (or at least data that we haven't thought to expect). Without knowing more about the device, steps to reproduce, or in general any more information, it's hard for us to do anything.
If you see this, please try to provide such information, as well as an up to date stack trace and the output of
Adding some additional paraphrasing from customers via WeChat:
The Xiaomi OS (?) has a 3 finger screenshot function. When using it on Flutter, it turns into one ACTION_DOWN and one ACTION_POINTER_DOWN in FlutterView.
On the dart side, that's 2 down. Then there's an ACTION_CANCEL but its getPointerCount is 3. When that reaches dart, it becomes 3 cancels which doesn't match the 2 from before.
So far, it's only reproducible on a Xiaomi 6X.
This was referenced
Feb 26, 2019
Here's the sequence of pointer events that Flutter is seeing when the user performs the three-finger screenshot gesture:
Pointer 1 down
The problem is that we get a cancel event for the third finger even though we never were told to track it. The fix is going to be to filter those "illegal" events out.