deleteMedia method
Implementation
Future<void> deleteMedia(String accessToken, String mediaId) async {
final Uri uri = Uri.parse('$url$mediaId');
try {
final http.Response res = await http.delete(
uri,
headers: {
'Authorization': 'Bearer $accessToken',
},
);
response = res.body;
httpCode = res.statusCode;
final Map<String, dynamic> jsonResponse = jsonDecode(response!);
errorMessage = jsonResponse['error']?['message'];
if (res.statusCode >= 400) {
error = res.reasonPhrase;
}
} catch (e) {
error = e.toString();
}
}