Error invoking clientX with Dart2JS

Issue

When compiling code with dart dart2js, and run in chrome or firefox

void main() {
  window.onMouseDown.listen((e) => print(e.clientX));
}

Result:

Uncaught TypeError: undefined is not a function

In Dartium there is no error.

Solution

e.client.x should work.
e.clientX was available for a long time but deprecated. Maybe it was removed recently.

Answered By – Günter Zöchbauer

Answer Checked By – David Marino (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *