getApiHeaders method

Map<String, String> getApiHeaders({
  1. bool isJson = false,
})

Implementation

Map<String, String> getApiHeaders({bool isJson = false}) {
  //debug("getApiHeaders token: ${_session?.token}");
  var headers = <String,String>{};
  // If POST or PUT methods this should be set to true
  if (isJson) headers["Content-Type"] = "application/json";
  // Check if we have token
  if (_session != null && _session!.token != null) headers["Authorization"] = "Bearer " + _session!.token!;

  return headers;
}