getFeatureStates method

Future<List<FeatureEnvironmentCollection>> getFeatureStates(
  1. List<String> apiKey, {
  2. Options? options,
  3. String? contextSha,
})

Requests all features for this sdkurl and disconnects

Implementation

Future<List<FeatureEnvironmentCollection>> getFeatureStates(
    List<String> apiKey,
    {Options? options,
    String? contextSha}) async {
  final response = await apiDelegate.getFeatureStates(apiKey,
      options: options, contextSha: contextSha);

  if (![200, 236, 400].contains(response.statusCode)) {
    throw ApiException(500,
        'Invalid response code ${response.statusCode} returned from API');
  }

  final __body = response.body;
  if (response.statusCode >= 400) {
    throw ApiException(response.statusCode,
        __body == null ? null : await decodeBodyBytes(__body));
  }

  if (__body == null) {
    throw ApiException(500, 'Received an empty body (not in a 204)');
  }

  return await apiDelegate.getFeatureStates_decode(__body);
}