removeFromToWatch method

Future<void> removeFromToWatch(
  1. Movie movie
)

Removes a movie from the to-watch list and saves to POD.

Implementation

Future<void> removeFromToWatch(Movie movie) async {
  // Only use MovieList - remove old TTL operations.

  if (_toWatchListId != null) {
    final success =
        await _movieListService.removeMovieFromList(_toWatchListId!, movie);
    if (success) {
      // Update stream with fresh data from MovieList.

      final movies = await getToWatch(forceRefresh: true);
      _toWatchController.add(movies);
      return;
    } else {
      debugPrint('❌ Failed to remove ${movie.title} from To Watch MovieList');
    }
  }

  // Fallback to old system if MovieList fails.

  final toWatch = await getToWatch();
  toWatch.removeWhere((m) => m.id == movie.id);
  await _saveToWatchToPod(toWatch);
  _toWatchController.add(toWatch);
}