build method Null safety

LDValue build()

Returns an LDValue of type LDValueType.OBJECT containing the builder's current elements.

Subsequent changes to the builder will not affect the returned value (it uses copy-on-write logic, so the previous values will only be copied to a new list if you continue to add elements after calling build).

Implementation

LDValue build() {
  _copyOnWrite = true;
  return _LDValueObject.ofMap(_builder);
}