Skip to content

Question - Getting error when trying to return from a function (via a Completer) once a sound stops. Why? #32

@TheIceMageX50

Description

@TheIceMageX50

I have a function like this that plays a sound and I want it to return only once the sound stops so I am trying to use a Completer.

  Future<bool> playAttackSound(AttackType type)
  {
    Sound s;
    Completer comp = new Completer();

    switch (type) {
    //init s based on type 
    ...
    }
    s.onStop.addOnce((Sound foo) => comp.complete(true));
    s.play();
    return comp.future;
  }
}

But...when I run my game once the sound plays I get these errors.

Closure call with mismatched arguments: function 'call'

NoSuchMethodError: incorrect number of arguments passed to method named 'call'
Receiver: Closure: (Sound) => dynamic
Tried calling: call(Instance of 'Sound', "")
Found: call(foo)

What's going on here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions