applyToParams method

  1. @override
void applyToParams(
  1. List<QueryParam> queryParams,
  2. Map<String, String> headerParams
)
override

Apply authentication settings to header and query params.

Implementation

@override
void applyToParams(
    List<QueryParam> queryParams, Map<String, String> headerParams) {
  if (_accessToken is String) {
    headerParams['Authorization'] = 'Bearer $_accessToken';
  } else if (_accessToken is HttpBearerAuthProvider) {
    headerParams['Authorization'] = 'Bearer ${_accessToken()}';
  } else {
    throw ArgumentError(
        'Type of Bearer accessToken should be a String or a String Function().');
  }
}