fix: defer clearShuffle call to avoid setState during build

This commit is contained in:
edde746
2025-11-21 03:52:59 +01:00
parent 2562d3d4b6
commit b1bed439eb
+5 -1
View File
@@ -105,7 +105,11 @@ class VideoPlayerScreenState extends State<VideoPlayerScreen>
// If this item doesn't have a playQueueItemID, it's a standalone item
// Clear any existing queue so next/previous work correctly for this content
if (widget.metadata.playQueueItemID == null) {
playbackState.clearShuffle();
// Defer clearing until after the first frame to avoid calling
// notifyListeners() during build
WidgetsBinding.instance.addPostFrameCallback((_) {
playbackState.clearShuffle();
});
} else {
playbackState.setCurrentItem(widget.metadata);
}