get method

Object? get(
  1. int index
)

The entry at index. Throws a RangeError when out of bounds.

Implementation

Object? get(int index) => scoped((arena) {
  final out = arena<c.wasmtime_val_t>();
  final found = c.wasmtime_table_get(
    store.context,
    _native(arena),
    index,
    out,
  );
  if (!found) {
    throw RangeError.index(index, this, 'index', null, length);
  }
  final kind = WasmValueKind.fromCKind(out.ref.kind);
  final value = toDartValue(store, kind, readValue(out));
  unrootValue(out);
  return value;
});