getMedia method Null safety

Future<MBMedia> getMedia(
  1. int mediaId

Retrieve the media of the project with the specified id.

  • Parameters:
    • mediaId: The id of the media to retrieve.
  • Returns a Future that completes with the MBMedia retrieved.


Future<MBMedia> getMedia(int mediaId) async {
  Map<String, String> apiParameters = {};
  String apiName = 'api/media/$mediaId';

  apiParameters.addAll(await defaultParameters());

  var uri = Uri.https(endpoint, apiName, apiParameters);
  var response = await http.get(uri, headers: await headers());
  Map<String, dynamic> body = MBManager.checkResponse(response.body);
  return MBMedia(dictionary: body);