Skip to content

[js_interop] RangeError when creating JSInt16Array on dart2wasm #61515

@sgrekhov

Description

@sgrekhov

The code below works as expected on dart2js but produces a run-time error on dart2wasm.

import 'dart:js_interop';
import 'dart:typed_data';

main() {
  ByteBuffer buffer = Int16List.fromList([42]).buffer;
  JSInt16Array a = JSInt16Array(buffer.toJS); // RangeError (start): Invalid value: Not in inclusive range 0..1: 2
  Int16List l = a.toDart;
  print(l.toList()); // On dart2js prints [42]
}

Am I doing anything wrong here? Or this is an issue?

cc @srujzs @osa1

Dart SDK version: 3.10.0-edge.6be105bb2405a44f5bf579e9387bc5080dee8c6b (main) (Tue Sep 16 19:37:19 2025 -0700) on "linux_x64"

Metadata

Metadata

Assignees

Labels

area-dart2wasmIssues for the dart2wasm compiler.area-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.web-js-interopIssues that impact all js interop

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions