setValue method
Sets the attribute with name
to the value
provided. Also marks the
attribute as private accordingly if private
is provided.
This method uses the LDValue type to represent a value of any JSON type: null, boolean, number, string, array, or object. For all attribute names that do not have special meaning to LaunchDarkly, you may use any of those types. Values of different JSON types are always treated as different values: for instance, null, false, and the empty string "" are not the same, and the number 1 is not the same as the string "1".
You cannot use this method to set the following attributes.
- "" - A name with an empty string.
- "kind"
- "key"
- "_meta"
Attempts to set these attributes will be ignored.
Values that are JSON arrays or objects have special behavior when referenced in flag/segment rules.
A value of LDValue.ofNull is equivalent to removing any current non-default value of the attribute. Null is not a valid attribute value in the LaunchDarkly model; any expressions in feature flags that reference an attribute with a null value will behave as if the attribute did not exist.
Implementation
LDAttributesBuilder setValue(String name, LDValue value,
{bool private = false}) {
_trySet(name, value, private);
return this;
}