getPropertyAtIndex method

JSValue getPropertyAtIndex(
  1. int propertyIndex, {
  2. bool autoDispose = true,
})

Gets a property from an object by numeric index. Calling JSObjectGetPropertyAtIndex is equivalent to calling JSObjectGetProperty with a string containing propertyIndex, but JSObjectGetPropertyAtIndex provides optimized access to numeric properties. propertyIndex (unsigned) An integer value that is the property's name. 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

JSValue getPropertyAtIndex(int propertyIndex, {bool autoDispose = true}) {
  final JSException exception = JSException.create(context);
  final valueRef = JSObjectGetPropertyAtIndex(
    context.ref,
    _ref,
    propertyIndex,
    exception.ref,
  );
  if (exception.shouldThrow) throw exception.error;
  return JSValue(context, valueRef, autoDispose: autoDispose);
}