From 8457dcb0f3a5341d6fce78d44178e22baffba8cf Mon Sep 17 00:00:00 2001 From: Ryan Heise Date: Sat, 5 Mar 2022 19:53:39 +1100 Subject: [PATCH] Fix unresponsive stop in background. --- just_audio_background/lib/just_audio_background.dart | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/just_audio_background/lib/just_audio_background.dart b/just_audio_background/lib/just_audio_background.dart index be05c8e5b..f016dc899 100644 --- a/just_audio_background/lib/just_audio_background.dart +++ b/just_audio_background/lib/just_audio_background.dart @@ -140,16 +140,18 @@ class _JustAudioBackgroundPlugin extends JustAudioPlatform { @override Future disposePlayer( DisposePlayerRequest request) async { - await _player?.release(); + final player = _player; _player = null; + await player?.release(); return DisposePlayerResponse(); } @override Future disposeAllPlayers( DisposeAllPlayersRequest request) async { - await _player?.release(); + final player = _player; _player = null; + await player?.release(); return DisposeAllPlayersResponse(); } }