setPropertyForKey method

void setPropertyForKey(
  1. JSValue propertyKey,
  2. JSValue? value, {
  3. JSPropertyAttributes attributes = JSPropertyAttributes.kJSPropertyAttributeNone,
})

Implementation

void setPropertyForKey(JSValue propertyKey, JSValue? value, {JSPropertyAttributes attributes = JSPropertyAttributes.kJSPropertyAttributeNone}) {
  final JSException exception = JSException.create(_context);
  try {
    js_bd.JSObjectSetPropertyForKey(_context.ref, _ref, propertyKey.ref, value?.ref ?? nullptr, JSPropertyAttributes.values.indexOf(attributes), exception.ref);
    if (exception.shouldThrow) {
      throw exception.error;
    }
  } finally {
    exception.release();
  }
}