migração flutter 2.2.1

This commit is contained in:
Renan
2021-06-01 16:52:01 -03:00
parent c44fcdddea
commit dd6bbb650b
25 changed files with 568 additions and 469 deletions
+5 -4
View File
@@ -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);