headers property

Map<String, String> headers

The headers for any authenticated HTTP REST call to a CarpBaseService.

Implementation

Map<String, String> get headers {
  if (CarpService().currentUser!.token == null)
    throw new CarpServiceException(
        message:
            "OAuth token is null. Call 'CarpService().authenticate()' first.");

  return {
    "Content-Type": "application/json",
    "Authorization":
        "bearer ${CarpService().currentUser!.token!.accessToken}",
    "cache-control": "no-cache"
  };
}