delete method
Manda una DELETE
Implementation
Future<Response> delete(
String url, {
Map? data,
Map<String, String>? headers,
}) async {
(headers ??= <String, String>{})
.putIfAbsent('Content-Type', () => 'application/json');
try {
final uri = Uri.parse(url);
final response = await _client.delete(
uri,
body: data == null ? {} : jsonEncode(data),
headers: headers,
);
_printLog(url, response, 'DELETE');
return response;
} catch (e) {
logger.w('[Provider-DELETE] Error on url $url: $e');
return Response(jsonEncode({'code': 'GENERIC_ERROR'}), 500);
}
}