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?