Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoSuchMethodError: The getter 'pointerRouter' was called on null. #33

Closed
Mirodil opened this issue Jan 17, 2019 · 1 comment
Closed

Comments

@Mirodil
Copy link

Mirodil commented Jan 17, 2019

Hi,
The code Flame.util.addGestureRecognizer(createTapRecognizer()); throws the following error:

[VERBOSE-2:shell.cc(184)] Dart Error: Unhandled exception:
NoSuchMethodError: The getter 'pointerRouter' was called on null.
Receiver: null
Tried calling: pointerRouter
#0      Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:50:5)
#1      Util.addGestureRecognizer (package:flame/util.dart:55:29)
#2      new MatchingGame (package:myapp/main.dart:24:16)
#3      main (package:myapp/main.dart:12:27)
#4      _startIsolate.<anonymous closure> (dart:isolate/runtime/libisolate_patch.dart:289:19)
#5      _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
Error -32601 received from application: Method not found

The code example:

class MGame extends BaseGame {
  
  MGame() {
    Flame.util.addGestureRecognizer(createTapRecognizer());
  }

 TapGestureRecognizer createTapRecognizer() {
    return new TapGestureRecognizer()
      ..onTapUp =
          (TapUpDetails details) => this.handleTap(details.globalPosition);
  }

  handleTap(Offset details) {
    // TODO:....
  }
}

Am I doing something wrong?

@Mirodil
Copy link
Author

Mirodil commented Jan 18, 2019

I found solution I had to call Flame.initializeWidget(); in the beginning of the program.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant