request method

Implementation

Future<ClientFeatureRepository> request() async {
  if (_deadConnection) return _repository;
  final bf = DateTime.now();
  if (DateTime.now().isBefore(_cacheTimeout)) return _repository;

  final options = xFeatureHubHeader == null
      ? null
      : (Options()
    ..headers = {'x-featurehub': xFeatureHubHeader});

  // added to break any caching if we change the header on the client side
  final sha = xFeatureHubHeader == null ? '0' :
  sha256.convert(utf8.encode(xFeatureHubHeader!)).toString();

  final response = await _api.apiDelegate
      .getFeatureStates(_apiKeys, options: options, contextSha: sha);

  await decodeResponse(response);

  return _repository;
}