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!);
  }
  // ignore: deprecated_member_use_from_same_package
  if (userSegment != null) {
    // ignore: deprecated_member_use_from_same_package
    baggage.setUserSegment(userSegment!);
  }
  if (transaction != null) {
    baggage.setTransaction(transaction!);
  }
  if (sampleRate != null) {
    baggage.setSampleRate(sampleRate!);
  }
  if (sampled != null) {
    baggage.setSampled(sampled!);
  }
  if (replayId != null) {
    baggage.setReplayId(replayId.toString());
  }
  return baggage;
}