toJS property
Converts this ByteBuffer to a JSArrayBuffer by either casting, unwrapping, or cloning the ByteBuffer.
Throws if the ByteBuffer wraps a JS SharedArrayBuffer.
Note
Depending on whether code is compiled to JavaScript or Wasm, this
conversion will have different semantics.
When compiling to JavaScript, ByteBuffers are either ArrayBuffers or
SharedArrayBuffers so this will just check the type and cast.
When compiling to Wasm, this ByteBuffer may or may not be a wrapper
depending on if it was converted from JavaScript or instantiated in
Dart. If it's a wrapper, this method unwraps it and either returns the
ArrayBuffer or throws if the unwrapped buffer was a
SharedArrayBuffer. If it's instantiated in Dart, this method clones
this ByteBuffer's values into a new JSArrayBuffer.
Avoid assuming that modifications to this ByteBuffer will affect the
JSArrayBuffer and vice versa unless it was instantiated in JavaScript.
Implementation
external JSArrayBuffer get toJS;