migração flutter 2.2.1
This commit is contained in:
@@ -7,7 +7,7 @@ import 'youtube_classes.dart';
|
||||
|
||||
class YouTubeApi{
|
||||
|
||||
Future<YouTubeSearchResponse> getChannelVideos({String nextPageToken = ''}) async {
|
||||
Future<YouTubeSearchResponse> getChannelVideos({String? nextPageToken = ''}) async {
|
||||
var retorno = new YouTubeSearchResponse(
|
||||
errorCode: 0,
|
||||
errorMessage: '',
|
||||
@@ -25,12 +25,13 @@ class YouTubeApi{
|
||||
|
||||
String url = "https://www.googleapis.com/youtube/v3/search?key=${FuncoesGerais.youtubeApiKey}&channelId=${FuncoesGerais.channelId}&part=snippet,id&order=date&maxResults=10";
|
||||
|
||||
if(nextPageToken.isNotEmpty) url += "&pageToken=$nextPageToken";
|
||||
if(nextPageToken!.isNotEmpty) url += "&pageToken=$nextPageToken";
|
||||
|
||||
try{
|
||||
var response = await http.get(url);
|
||||
var response = await http.get(Uri.parse(url));
|
||||
|
||||
if (response != null) {
|
||||
//if (response != null) {
|
||||
if (response.body.isNotEmpty) {
|
||||
if (response.statusCode == 200) {
|
||||
var data = jsonDecode(response.body);
|
||||
retorno = YouTubeSearchResponse.fromJson(data);
|
||||
|
||||
Reference in New Issue
Block a user