setPropertyForKey method

void setPropertyForKey(
  1. String propertyKey,
  2. JSValue value,
  3. JSPropertyAttributes attributes, {
  4. JSValuePointer? exception,
})

Sets a property on an object using a JSValueRef as the property key. This function is the same as performing "objectpropertyKey = value" from JavaScript. propertyKey (JSValueRef) A JSValueRef containing the property key to use when looking up the property. value (JSValueRef) A JSValueRef to use as the property's value. attributes (JSPropertyAttributes) A logically ORed set of JSPropertyAttributes to give to the property. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.

Implementation

void setPropertyForKey(
  String propertyKey,
  JSValue value,
  JSPropertyAttributes attributes, {
  JSValuePointer? exception,
}) {
  JSObjectRef.jSObjectSetPropertyForKey(
      context.pointer,
      pointer,
      JSString.fromString(propertyKey).pointer,
      value.pointer,
      jSPropertyAttributesToCEnum(attributes),
      (exception ?? JSValuePointer(nullptr)).pointer);
}