kind method

LDAttributesBuilder kind(
  1. String kind, [
  2. String? key
])

Adds another kind to the context. kind and optional key must be non-empty. Calling this method again with the same kind returns the same LDAttributesBuilder as before.

If key is omitted, this will create an anonymous context with a generated key. The generated key will be persisted and reused for future application runs.

Implementation

LDAttributesBuilder kind(String kind, [String? key]) {
  LDAttributesBuilder builder = _buildersByKind.putIfAbsent(
      kind, () => LDAttributesBuilder._internal(this, kind));

  if (key != null) {
    // key may be different on this subsequent call, so need to update it.
    builder._key = key;
  }

  return builder;
}