modwedar / YoutubeDataApi

A Flutter package for fetching complete data from YouTube.
Apache License 2.0
10 stars 13 forks source link

fixed null exception #6

Open ebel-frank opened 1 year ago

ebel-frank commented 1 year ago

I kept getting this an exception when I call the function youtubeDataApi.fetchVideoData(videoId). Below is the exception.

Unhandled Exception: NoSuchMethodError: The method '[]' was called on null. E/flutter (16928): Receiver: null E/flutter (16928): Tried calling: E/flutter (16928): #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:38:5) E/flutter (16928): #1 new VideoPage.fromMap (package:youtube_data_api/models/video_page.dart:47:167) E/flutter (16928): #2 YoutubeDataApi.fetchVideoData (package:youtube_data_api/youtube_data_api.dart:435:28) E/flutter (16928): E/flutter (16928): #3 _FutureBuilderState._subscribe. (package:flutter/src/widgets/async.dart:628:33)

It seems youtube updated their apis, so I modified the code to fit with what the api was returning.