removeMovieListFromProfile method

Future<bool> removeMovieListFromProfile(
  1. String movieListId
)

Removes a movie list ID from the user profile.

Implementation

Future<bool> removeMovieListFromProfile(String movieListId) async {
  try {
    final profile = await getUserProfile();
    if (profile == null) return false;

    final movieListIds = List<String>.from(profile['movieListIds'] ?? []);
    if (movieListIds.contains(movieListId)) {
      movieListIds.remove(movieListId);

      return await createOrUpdateUserProfile(
        apiKey: profile['apiKey'],
        dobString: profile['dob'],
        genderString: profile['gender'],
        movieListIds: movieListIds,
      );
    }

    return true;
  } catch (e) {
    debugPrint('❌ Failed to remove movie list from profile: $e');
    return false;
  }
}