getRelatedVideos method

Future<RelatedVideosList?> getRelatedVideos(
  1. Video video
)

Returns a RelatedVideosList or null if no related videos were found.

Implementation

Future<RelatedVideosList?> getRelatedVideos(Video video) async {
  // Try 3 times before giving up
  for (var i = 0; i < 3; i++) {
    final client = await RelatedVideosClient.get(_httpClient, video);
    if (client != null) {
      return RelatedVideosList(
          client.relatedVideos().toList(), client, _httpClient);
    }
  }
  return null;
}