decodeResponse method
Future<void>
decodeResponse(
- ApiResponse response
)
Implementation
Future<void> decodeResponse(ApiResponse response) async {
if (response.statusCode == 200 || response.statusCode == 236) {
checkForCacheControl(response);
final environments = await _api.apiDelegate.getFeatureStates_decode(response.body!);
success(environments);
if (response.statusCode == 236) {
_log.warning("featurehub: this environment has gone stale and will not receive further updates.");
_deadConnection = true;
}
} else if (response.statusCode == 400 || response.statusCode == 404) {
_repository.notify(SSEResultState.failure, null);
}
if (_timeoutInSeconds > 0) {
_cacheTimeout = DateTime.now().add(Duration(seconds: _timeoutInSeconds));
}
}