Skip to content

dart2js: creating a Uint8List throws: full width integer not supported on this platform #48562

@konsultaner

Description

@konsultaner

For some reason it is impossible for me to work with Uint8List in dart2js converted libs.

I tried this:

js.allowInterop((js.JsArray listOfInt) {
    var convertedList = Uint8List.fromList([for (var i = 0; i < listOfInt.length; i++) listOfInt[i] as int]);
    // throws: Uncaught full width integer not supported on this platform
    // if I don't cast or use int.parse(). I obviously get a type error
});

when [omitting type checks][4] and doing something like this:

js.allowInterop((js.JsArray listOfInt) {
    var convertedList = Uint8List.fromList(listOfInt);
    // throws: Uncaught full width integer not supported on this platform
});
js.allowInterop((js.JsArray listOfInt) {
    print(base64Encode(listOfInt)); // this works
    var convertedList = base64Decode(base64Encode(listOfInt));
    // throws: Uncaught full width integer not supported on this platform
});

This tracker is for issues related to:

  • dart2js

Platform

  • Dart SDK version: 2.14.4 (stable) (Wed Oct 13 11:11:32 2021 +0200) on "windows_x64"
  • Windows
  • Chrome

Issue at stack overflow

https://stackoverflow.com/questions/71481645/dartjs-convert-jsarray-from-allowinterop-to-uint8list

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.web-dart2jsweb-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