headers property

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

Headers property for requests.

Implementation

@override
Future<Map<String, String>> get headers async {
  final headers = Map<String, String>.from(await _baseHeaders);

  if (authType == AuthType.browser) {
    headers['authorization'] = getAuthorization('$_sapisid $_origin');
  } else if (authType == AuthType.oauthCustomClient) {
    headers['authorization'] = _token != null ? _token.asAuth() : '';
    headers['X-Goog-Request-Time'] = DateTime.now().millisecondsSinceEpoch
        .toString()
        .substring(0, 10);
  }
  return headers;
}