toDartIntList property

List<int> get toDartIntList

Converts this to a List of ints.

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 a toJS* method, this getter simply casts the Array. Otherwise, it wraps the Array with a List that casts the elements to int on access to ensure soundness.

When compiling to Wasm, this clones the Array's values into a new List. If the Array contains any non-integer values, this will throw a TypeError.

Avoid assuming that modifications to this JSArray will affect the returned List and vice versa in all compilers.

Implementation

external List<int> get toDartIntList;