call method
Future
call(})
Implementation
Future<dynamic> call(
String data, BuildContext? context, String url, String token,
{Function? noNetworkCallBack,
Function(BuildContext)? sessionExpiredCallback,String? clientId,String? clientSecret}) async {
log(token, name: "Header Token");
log(url, name: "Api Url");
var headers = {
"Content-Type": 'application/json',
"Authorization": token,
};
if(clientId!=null && clientSecret!=null){
headers.putIfAbsent("X-Client-Id",()=>clientId);
headers.putIfAbsent("X-Client-Secret",()=>clientSecret);
}
log(headers.toString(), name: "Headers");
return _netUtil
.post(context, url,
body: data,
headers: headers,
noNetworkCallBack: noNetworkCallBack,
sessionExpiredCallback: sessionExpiredCallback)
.then((dynamic res) {
return _decoder.convert(res.toString());
}).catchError((onError) {
log(onError.toString());
});
}