deleteMovieList method
- String movieListId
Deletes a MovieList.
Implementation
Future<bool> deleteMovieList(String movieListId) async {
try {
final loggedIn = await isLoggedIn();
if (!loggedIn) return false;
// Remove from user profile first.
try {
await _userProfileService.removeMovieListFromProfile(movieListId);
} catch (e) {
debugPrint('❌ Failed to remove movie list from profile: $e');
// Continue with deletion even if profile update fails.
}
// Delete from POD.
if (!_context.mounted) return false;
// Get the standard file path for deletion.
final filePath = _getMovieListFilePath(movieListId);
await deleteFile('moviestar/data/$filePath');
// Remove from cache.
_movieListCache.remove(movieListId);
return true;
} catch (e) {
debugPrint('❌ Failed to delete movie list: $e');
return false;
}
}