Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

233
Vistas
dart:js convert JsArray from allowInterop to Uint8List

I try to make my dart code to be available in JS as well. It works fine. All my code is accessible through JavaScript. The only problem I have is that allowInterop only passes dynamic types. A passed JsArray is actually a JsArray<dynamic>.

What I want to have is a Uint8List.

What I tried so far:

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 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
});

Seems like I just don't do it right. Is it somehow possible to have less generic types passed to allowInterop or somehow ignore types in the js environment?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda