Not sure if its a compiler limitation or something I don't understand (likely the last :-))
I'm trying to access a "DataView" structure buried in an native java-script class. I got it to work in debug mode; however, when compiled for deployment, the solution isn't working.
await _transferIn(adapter, 5, 64).then((usbInTransferResult){
log.finest('_transferIn.then');
js.context['console'].callMethod('log', [usbInTransferResult]);
var rxLen = usbInTransferResult['data']['byteLength']; <<<<< Fails
for( var index = 0; index < rxLen; index++ ){
rxData.add(usbInTransferResult['data'].callMethod('getUint8', [index])); <<<<< Fails
};
log.finest(rxData);
return completer.complete(rxData);
});
The above code reads a data packet received through USB (WebUSB). It reads the received package length and puts it copies each byte into a List<int>
. In both places (reading the property byteLength
and calling method getUint8([index])
fails only when compiled for deployment.
Below a picture of the reported error
Below a picture of a successful run (in debug mode)
Please notice the additional DART symbols (which are missing in the picture above).
ps. I'm using DART-SDK 2.0.0 (tried also 2.1.0-dev.8.0), and Angular-DART 5.0.0, within a WebStorm project.