captureUserFeedback method

Future<void> captureUserFeedback(
  1. SentryUserFeedback userFeedback
)

Implementation

Future<void> captureUserFeedback(SentryUserFeedback userFeedback) async {
  if (!_isEnabled) {
    _options.logger(
      SentryLevel.warning,
      "Instance is disabled and this 'captureUserFeedback' call is a no-op.",
    );
    return;
  }
  if (userFeedback.eventId == SentryId.empty()) {
    _options.logger(
      SentryLevel.warning,
      'Captured UserFeedback with empty id, dropping the feedback',
    );
    return;
  }
  try {
    final item = _peek();

    await item.client.captureUserFeedback(userFeedback);
  } catch (exception, stacktrace) {
    _options.logger(
      SentryLevel.error,
      'Error while capturing user feedback for ${userFeedback.eventId}',
      exception: exception,
      stackTrace: stacktrace,
    );
  }
}