location method Null safety

Future<String> location(
  1. {required String videoId}
)

Supply the videoId and retrieve the url used to upload the thumbnail image

Implementation

Future<String> location({required String videoId}) async {
  String uploadType = 'resumable';

  final httpResponse =
      await _rest.thumbnailLocation(_authHeader, accept, videoId, uploadType);

  if (!httpResponse.response.headers.map.containsKey('location')) {
    throw Exception(
        'Upload location for the thumbnail could not be determined');
  }

  return httpResponse.response.headers.value('location')!;
}