@
huohei 第一种写法:
onTap: () {
AudioPlayer audioPlayer = AudioPlayer();
//点击时播放背景音乐
audioPlayer.play('click.mp3');
},
click.mp3 处报错:The argument type 'String' can't be assigned to the parameter type 'Source'.
第二种写法:
onTap: () {
AudioCache audioCache = AudioCache();
//点击时播放背景音乐
audioCache.play('click.mp3');
},
.play 处报错:The method 'play' isn't defined for the type 'AudioCache'.
Try correcting the name to the name of an existing method, or defining a method named 'play'.