Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

240
Visualizações
dart:js convertir JsArray de allowInterop a Uint8List

Intento que mi código dart también esté disponible en JS. Funciona bien. Todo mi código es accesible a través de JavaScript. El único problema que tengo es que allowInterop solo pasa tipos dynamic . Un JsArray aprobado es en realidad un JsArray<dynamic> .

Lo que quiero tener es un Uint8List .

Lo que probé hasta ahora:

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

al omitir las comprobaciones de tipo y hacer algo como esto:

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

Parece que simplemente no lo hago bien. ¿Es posible de alguna manera pasar tipos menos genéricos a allowInterop o ignorar de alguna manera los tipos en el entorno js?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda