I use a Dart script in a web page and need to play a WAV file in the browser when a certain event is triggered. I do not use Flutter. Instead, it is a simple DOM-interacting program. What I’m looking for is basically the Dart counterpart of the following JavaScript:
function playSound(url) {
const audio = new Audio(url);
audio.play();
}
One can play a sound from a URL by writing:
One can reuse
clickSoundfor playing it as often as you need.