add sound to my flutter app code example

Example 1: add sound to my flutter app

void playRemoteFile() {    AudioPlayer player = new AudioPlayer();    player.play("https://bit.ly/2CH50TO");}

Example 2: add sound to my flutter app

Future playLocalAsset() async {    AudioCache cache = new AudioCache();    return await cache.play("myCustomSoundEffect.mp3");}

Example 3: add sound to my flutter app

import 'package:audioplayers/audio_cache.dart';import 'package:audioplayers/audioplayers.dart';

Example 4: add sound to my flutter app

assets:  - assets/myCustomSoundEffect.mp3

Tags:

Misc Example