callWithoutToken method

Future callWithoutToken(
  1. String data,
  2. BuildContext? context,
  3. String url, {
  4. Function? noNetworkCallBack,
  5. dynamic sessionExpiredCallback(
    1. BuildContext
    )?,
  6. String? clientId,
  7. String? clientSecret,
})

Implementation

Future<dynamic> callWithoutToken(
    String data, BuildContext? context, String url,
    {Function? noNetworkCallBack,
    Function(BuildContext)? sessionExpiredCallback,String? clientId,String? clientSecret}) async {
  log(url, name: "Api Url");
  var headers = {"Content-Type": 'application/json'};

  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());
  });
}