applyToParams method

  1. @override
void applyToParams(
  1. QueryParams query,
  2. Map<String, String?> headers
)
override

Apply authentication settings to header and query params.

Implementation

@override
void applyToParams(QueryParams query, Map<String, String?> headers) {
  String? value;
  if (apiKeyPrefix != null) {
    value = '$apiKeyPrefix $apiKey';
  } else {
    value = apiKey;
  }

  if (location == 'query' && value != null) {
    query[paramName] = value;
  } else if (location == 'header' && value != null) {
    headers[paramName] = value;
  }
}