copyWithBaggage method

Context copyWithBaggage(
  1. Baggage moreBaggage
)

Creates a new Context adding in moreBaggage, replacing any existing keys that are the same as the keys in moreBaggage Creates a new Context with additional Baggage entries.

This merges any existing Baggage with the new Baggage, with new entries replacing existing entries that have the same keys.

Implementation

Context copyWithBaggage(Baggage moreBaggage) {
  final currentBaggage = baggage;
  final newBaggage = currentBaggage == null
      ? moreBaggage
      : currentBaggage.copyWithBaggage(moreBaggage);
  return ContextCreate.create(contextMap: {
    ..._values,
    _baggageKey: newBaggage,
  });
}