delete method Null safety

Future delete(
  1. {required String url,
  2. Map<String, dynamic> queryParams = const {},
  3. Map<String, dynamic> body = const {},
  4. Map<String, String> headers = const {}}
)

Implementation

Future<dynamic> delete({
  required String url,
  Map<String, dynamic> queryParams = const {},
  Map<String, dynamic> body = const {},
  Map<String, String> headers = const {},
}) async {
  // await ConnectionManager.readyToExecuteAPIRequest(force: bypassAuth);

  final uri = Uri(
    scheme: isLocal ? 'http' : 'https',
    host: baseUrl,
    path: url,
    queryParameters: _convertQueryParams(queryParams),
  );
  final request = http.Request('DELETE', uri);
  request.headers.addAll(commonHeaders());
  request.body = jsonEncode(body);
  request.headers.addAll(headers);

  final res = await request.send();
  final result = await http.Response.fromStream(res);
  return _response(result);
}