getVideoFromId method Null safety

  1. @override
Future<VideoFull> getVideoFromId(
  1. String videoId,
  2. {List<Includes>? includes}
)

Get a video by its video ID

Returns VideoFull

Arguments:

  • videoId The video ID as a string
  • includes Request extra data be included in the results. They are not guarenteed to be returned.

Implementation

@override
Future<VideoFull> getVideoFromId(
  String videoId, {
  List<Includes>? includes,
}) async {
  final Map<String, dynamic> params = {'id': videoId};

  // Add the info the videos must include
  _addIncludes(includes, params);

  final Response response =
      await get(path: _Constants.videosPath, params: params);

  return VideoFull.fromMap(jsonDecode(response.body).first);
}