setPropertyUnsafe method

void setPropertyUnsafe(
  1. String property,
  2. Object? value
)

Setting a property only sets field if value is non-null in order to reduce JSON payload size by excluding null properties.

  • Don't use directly in application code.

Implementation

void setPropertyUnsafe(String property, Object? value)
{
  if (value != null) {
    _setMapKey(property, value);
  }
  else {
    // Avoid setting null property if is empty, so JSON is more compact.
    // This reduces size of brochure JSON by 21% by avoiding storing empty properties.
    removeProperty(property);
  }
}