headers property

  1. @override
Map<String, String> get headers
override

The headers for any authenticated HTTP REST call to this CarpService.

Implementation

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

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