У меня такая ошибка при использовании API данных Youtube;
E/flutter ( 4218): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: 'No filter selected. Expected one of: id, channelId, mine'
E/flutter ( 4218): #0 APIService.fetchVideosFromPlaylist (package:niro_speaks/services/api_services.dart:81:7)
E/flutter ( 4218): <asynchronous suspension>
E/flutter ( 4218): #1 APIService.fetchChannel (package:niro_speaks/services/api_services.dart:38:30)
E/flutter ( 4218): <asynchronous suspension>
Вот как я получаю api и реализован в api_services.dart
Future<Channel> fetchChannel({String channelId}) async {
Map<String, String> parameters = {
'part': 'snippet, contentDetails, statistics',
'id': channelId,
'key': API_KEY,
};
Uri uri = Uri.https(
_baseUrl,
'/youtube/v3/channels',
parameters,
);
Map<String, String> headers = {
HttpHeaders.contentTypeHeader: 'application/json',
};
// Get Channel
var response = await http.get(uri, headers: headers);
if (response.statusCode == 200) {
Map<String, dynamic> data = json.decode(response.body)['items'][0];
Channel channel = Channel.fromMap(data);
// Fetch first batch of videos from uploads playlist
channel.videos = await fetchVideosFromPlaylist(
playlistId: channel.uploadPlaylistId,
);
return channel;
} else {
throw json.decode(response.body)['error']['message'];
}
}
Кто-нибудь, пожалуйста, помогите мне устранить эту ошибку?