getHeaders method

Future<Map<String, String>> getHeaders({
  1. String contentType = 'application/json',
})

Implementation

Future<Map<String, String>> getHeaders({
  String contentType = 'application/json',
}) async {
  String? token = await this.getToken();
  Map<String, String> baseHeaders = {
    'content-type': contentType,
    'accept': 'application/ld+json',
  };

  if (token != null) {
    baseHeaders['authorization'] = 'Bearer $token';
  }

  return baseHeaders;
}