mergeContext method

LDContextBuilder mergeContext(
  1. LDContext context
)

Adds a context to the context builder combining the provided context kinds with the existing kinds in the builder. This function is not normally needed as the kind method can be used for making a multi-context.

Implementation

LDContextBuilder mergeContext(LDContext context) {
  for (var MapEntry(key: kind, value: attributes)
      in context.attributesByKind.entries) {
    final attributesBuilder = this.kind(kind, attributes.key);
    attributesBuilder.anonymous(attributes.anonymous);
    if (attributes.name != null) {
      attributesBuilder.name(attributes.name!);
    }
    attributesBuilder._privateAttributes.addAll(attributes.privateAttributes);
    for (var MapEntry(key: name, value: attributeValue)
        in attributes.customAttributes.entries) {
      attributesBuilder.setValue(name, attributeValue);
    }
  }
  return this;
}