deleteMedia method

Future<void> deleteMedia(
  1. int mediaId
)

Deletes a media (image or file).

  • Parameters:
    • mediaId: The id of the media that needs to be deleted.
  • Returns a Future that completes when the media is deleted correctly.

Implementation

Future<void> deleteMedia(int mediaId) async {
  String apiName = 'api/media/$mediaId';

  var uri = Uri.https(manager.endpoint, apiName);
  http.Response response = await http.delete(
    uri,
    headers: await manager.headers(),
  );

  MBManager.checkResponse(response.body, checkBody: false);
}