import 'dart:async'; import 'package:collection/collection.dart'; import '../../youtube_explode_dart.dart'; import '../extensions/helpers_extension.dart'; import '../reverse_engineering/pages/search_page.dart'; import 'base_search_content.dart'; /// This list contains search videos. ///This behaves like a [List] but has the [SearchList.nextPage] to get the next batch of videos. class SearchList extends DelegatingList { final SearchPage _page; final YoutubeHttpClient _httpClient; /// Construct an instance of [SearchList] /// See [SearchList] SearchList(List base, this._page, this._httpClient) : super(base); /// Fetches the next batch of videos or returns null if there are no more /// results. Future nextPage() async { final page = await _page.nextPage(_httpClient); if (page == null) { return null; } return SearchList(page.searchContent as List, page, _httpClient); } } class VideoSearchList extends DelegatingList