setFeatureState method
Future<void>
setFeatureState(
- String sdkUrl,
- String featureKey,
- FeatureStateUpdate featureStateUpdate, {
- Options? options,
Requests all features for this sdkurl and disconnects
Updates the feature state if allowed.
Implementation
Future<void> setFeatureState(
String sdkUrl, String featureKey, FeatureStateUpdate featureStateUpdate,
{Options? options}) async {
final response = await apiDelegate.setFeatureState(
sdkUrl,
featureKey,
featureStateUpdate,
options: options,
);
if (![200, 201, 202, 400, 403, 404, 412].contains(response.statusCode)) {
throw ApiException(500,
'Invalid response code ${response.statusCode} returned from API');
}
if (response.statusCode == 204) {
return;
}
final __body = response.body;
if (response.statusCode >= 400) {
throw ApiException(response.statusCode,
__body == null ? null : await decodeBodyBytes(__body));
}
throw ApiException(500, 'Invalid response received for 204 based API');
}