channel method

Future<List<YouTubeVideo>> channel(
  1. String channelId, {
  2. String? order,
})

Implementation

Future<List<YouTubeVideo>> channel(String channelId, {String? order}) async {
  this.getTrending = false;
  final url = api!.channelUri(channelId, order);
  var res = await http.get(url, headers: headers);
  var jsonData = json.decode(res.body);
  if (jsonData['error'] != null) {
    throw jsonData['error']['message'];
  }
  if (jsonData['pageInfo']['totalResults'] == null) return <YouTubeVideo>[];
  List<YouTubeVideo> result = await _getResultFromJson(jsonData);
  return result;
}