toBaggage method

SentryBaggage toBaggage({
  1. SentryLogger? logger,
})

Implementation

SentryBaggage toBaggage({
  SentryLogger? logger,
}) {
  final baggage = SentryBaggage({}, logger: logger);
  baggage.setTraceId(traceId.toString());
  baggage.setPublicKey(publicKey);

  if (release != null) {
    baggage.setRelease(release!);
  }
  if (environment != null) {
    baggage.setEnvironment(environment!);
  }
  if (userId != null) {
    baggage.setUserId(userId!);
  }
  if (userSegment != null) {
    baggage.setUserSegment(userSegment!);
  }
  if (transaction != null) {
    baggage.setTransaction(transaction!);
  }
  if (sampleRate != null) {
    baggage.setSampleRate(sampleRate!);
  }
  if (sampled != null) {
    baggage.setSampled(sampled!);
  }
  return baggage;
}