florent37 / Flutter-AssetsAudioPlayer

Play simultaneously music/audio from assets/network/file directly from Flutter, compatible with android / ios / web / macos, displays notifications
https://pub.dartlang.org/packages/assets_audio_player
Apache License 2.0
740 stars 337 forks source link

What do I need to clean up after using Assets Audio Player? #812

Open davoutuk opened 8 months ago

davoutuk commented 8 months ago

It's not clear to me what I need to do when using Asssets Audio Player iin terms of freeing/releasing resources.

For example, I have the following standalone method in one of my classes...


  Future<void> _playWarning() async {
    final aPlayer = AssetsAudioPlayer();
    try {
      await aPlayer.open(Audio(PomodoroSoundAssets.getWarning()) );
      await aPlayer.play();
    } catch (t) {
      //stream unreachable
    }
  }

.... should I include a 'finally' block that releases something?