refreshUIStreams method

Future<void> refreshUIStreams()

Forces a refresh of the UI streams with current data from MovieLists. This ensures the UI shows the latest data after app restart.

Implementation

Future<void> refreshUIStreams() async {
  try {
    // Don't update streams if MovieList IDs aren't initialised yet.
    // This prevents showing empty state before MovieList discovery completes.

    if (_toWatchListId == null && _watchedListId == null) {
      return;
    }

    final toWatchMovies = await getToWatch(forceRefresh: true);
    final watchedMovies = await getWatched(forceRefresh: true);

    _toWatchController.add(toWatchMovies);
    _watchedController.add(watchedMovies);
  } catch (e) {
    debugPrint('❌ Failed to refresh UI streams: $e');
  }
}