getWatched method

Future<List<Movie>> getWatched({
  1. bool forceRefresh = false,
})

Retrieves the list of watched movies from POD cache.

Implementation

Future<List<Movie>> getWatched({bool forceRefresh = false}) async {
  // Read from MovieList file instead of cached old TTL data.

  if (_watchedListId != null) {
    final movieListData = await _movieListService
        .getMovieList(_watchedListId!, forceRefresh: forceRefresh);
    if (movieListData != null) {
      final movies = movieListData['movies'] as List<Movie>? ?? [];
      return List.from(movies);
    }
  }

  // Fallback to cached data if MovieList fails.

  if (_cachedWatched != null) {
    return List.from(_cachedWatched!);
  }

  // Final fallback to SharedPreferences.

  return _fallbackService.getWatched();
}