0
我有這個功能,在Flutter內使用audioplayer plugin播放聲音。Dart - 玩一圈期貨
play(int soundFrequency) async {
final result = await audioPlayer.play("urltosound.wav");
}
它工作正常。但現在我希望能夠連續播放多個聲音。看起來好像我搞砸了期貨。我試過這種方法,這是非常骯髒和醜陋,但我只是想搞清楚這些事情:
playRandomSequence() async {
final result = audioPlayer.play("urltosound.wav").then(play2(pickRandomSoundFrequency()));
}
play2(int soundFrequency) async {
final result = audioPlayer.play("urltosound.wav");
}
基本上,只要第一個未來了吧,我叫下一個用。那麼()方法。
我從中得到的是這樣的錯誤:
type '_Future' is not a subtype of type '(dynamic) => dynamic' of 'f' where _Future is from dart:async
我該如何解決這個問題?
感謝