File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -430,10 +430,10 @@ class MediaPlayer extends ChangeNotifier {
430430 }
431431
432432 Future <void > playAll (List songs, {int index = 0 }) async {
433- autoFetching = true ;
434-
435433 if (songs.isEmpty) return ;
436434
435+ autoFetching = true ;
436+
437437 _buttonState.value = ButtonState .loading;
438438 notifyListeners ();
439439
@@ -451,10 +451,16 @@ class MediaPlayer extends ChangeNotifier {
451451 // Add rest of playlist completely in background (fire and forget)
452452 if (songs.length > 1 ) {
453453 // Use unawaited to truly run in background
454- Future (() => _addRemainingToPlaylist (songs, index));
454+ Future (() async {
455+ await _addRemainingToPlaylist (songs, index);
456+ autoFetching = false ;
457+ });
458+ }
459+ else {
460+ autoFetching = false ;
455461 }
456- autoFetching = false ;
457462 } catch (e) {
463+ autoFetching = false ;
458464 print ('Error in playAll: $e ' );
459465 _buttonState.value = ButtonState .paused;
460466 notifyListeners ();
You can’t perform that action at this time.
0 commit comments