getMethod static method
Implementation
static Future<Response> getMethod(
{required Uri url, Map<String, String>? headers,
Map<String, dynamic>? body,
}) async{
var request = MultipartRequest('GET', url);
if(headers != null){
request.headers.addAll(headers);
}
if (body != null) {
// Convert the body map to JSON
var jsonBody = jsonEncode(body);
// Set the JSON body to the request
request.fields['_json'] = jsonBody; // You can use a custom field key if required
// for (var entry in body.entries) {
// request.fields[entry.key] = entry.value.toString();
// }
}
var streamedResponse = await request.send();
var response = await Response.fromStream(streamedResponse);
return response;
}