Skip to content

ByteDataToJSDataView

extension ByteDataToJSDataView on ByteData

Conversions from ByteData to JSDataView.

Properties

toJS extension no setter

JSDataView get toJS

Converts this ByteData to a JSDataView by either casting, unwrapping, or cloning the ByteData.

INFO

Depending on whether code is compiled to JavaScript or Wasm, this conversion will have different semantics.

When compiling to JavaScript, all typed lists are the equivalent JavaScript typed arrays, and therefore this getter simply casts.

When compiling to Wasm, this ByteData is a wrapper around a DataView if it was converted via JSDataViewToByteData.toDart. If it is a wrapper, this getter unwraps it and returns the DataView. If it's instantiated in Dart, this getter clones this ByteData's values into a new JSDataView.

Avoid assuming that modifications to this ByteData will affect the returned JSDataView and vice versa on all compilers unless it was first converted via JSDataViewToByteData.toDart.

Available on ByteData, provided by the ByteDataToJSDataView extension

Implementation
dart
external JSDataView get toJS;