The method 'play' isn't defined for the type 'AudioCache'

6 min read

The code below is no longer valid from audioplayers v1.0.1

final player = AudioCache();
player.play('note1.wave');

Instead U can do this

final player = AudioPlayer();
//
player.play(UrlSource('note1.wave'));

// If file located in assets folder like assets/sounds/note01.wave"
await player.play(AssetSource('sounds/note1.wave'));

consider look in migration guide from audioplayers