toDart property

List<T> get toDart

Converts this JSArray to a List by either casting or wrapping it.

Note

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

When compiling to JavaScript, core Lists are Arrays and therefore, if the JSArray was already a List converted via ListToJSArray.toJS, this getter simply casts the Array. Otherwise, it wraps the Array with a List that casts the elements to T to ensure soundness.

When compiling to Wasm, the JSArray is wrapped with a List implementation and the wrapper is returned.

Modifications to this JSArray will affect the returned List and vice versa.

Implementation

external List<T> get toDart;