delete method
Implementation
Future<dynamic> delete({
String? baseUrl,
String? authorization,
required String path,
String? id,
bool skipJsonDecode = false,
}) async {
http_package.Response? response;
try {
baseUrl ??= Api.getAPIBaseUrls();
final url = Uri.parse((baseUrl) + path + (id != null ? '/$id' : ''));
log('DELETE---$url');
response = await http_package.delete(
url,
headers: header(authorization),
);
log('Status Code:${response.statusCode}');
log('Response : ${response.body}');
if (skipJsonDecode || isFailure(response.statusCode)) {
return response.body;
}
if (response.body.isEmpty) {
return <String, dynamic>{};
}
return json.decode(response.body);
} catch (exception) {
log(exception.toString());
rethrow;
}
}