onFeedbackSubmit method

dynamic onFeedbackSubmit(
  1. String feedback
)

Implementation

onFeedbackSubmit(String feedback) async {
  final config = this.config;
  if (config == null) {
    debugPrint("onFeedbackSubmit is called while Config is null");
    return;
  }
  _localEmit(_state.copyWith(state: RateExpState.submitting));
  try {
    var commonContext = await DeviceDataCollector.collect();
    var feedbackPayload = RateExperienceResult(
        _tagSelectionHistory.values.toList(),
        _selectedRating,
        feedback,
        config.numberOfStars,
        userContext,
        commonContext);
    await repository.publishResult(feedbackPayload);
    _localEmit(_state.copyWith(state: RateExpState.submissionSuccess));
  } catch (e) {
    debugPrint(e.toString());
    _localEmit(_state.copyWith(state: RateExpState.submissionError));
  }
}