post static method
Implementation
static Future<http.Response> post({
required Uri url,
required String body,
Map<String, String>? headers,
}) async {
if (JwtDecoder.isExpired(Config.accessToken)) {
await Config.refreshAccessToken();
}
var headersToBeSent = <String, String>{
"Authorization": "Bearer ${Config.accessToken}",
"Content-Type": "application/json"
};
if (headers != null && headers.isNotEmpty) {
headersToBeSent.addAll(headers);
}
var response = await http.post(
url,
headers: headersToBeSent,
body: body,
);
return response;
}