patch method Null safety

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

Implementation

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

  final uri = Uri(
    scheme: isLocal ? 'http' : 'https',
    host: baseUrl,
    path: url,
    queryParameters: _convertQueryParams(queryParams),
  );

  final request = http.Request('PATCH', uri);
  request.headers.addAll(commonHeaders());
  request.headers.addAll(headers ?? {});

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