Run desktop app Lost connection to device.
- Dominant language
- Dart
- Stars
- 275
- Forks
- 144
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 47
Description
run windows . flutter calls the DLL, and already gets the value returned by c. But then it will lose connection to device.
I don't know what's causing this.Below is my code
` Future sendAPDUHex(String cmd) async {
int sendLen = cmd.length ~/ 2;
try {
Pointer apduRLen = calloc.allocate(sizeOf());
Pointer apduResData = calloc.allocate(sizeOf());
Pointer sendData = cmd.toNativeUtf8();
int apduRst =
await cpuAPDUHexFun(icDev, sendLen, sendData, apduRLen, apduResData);
debugPrint("apduRst=$apduRst");
if (apduRst != 0) {
return "";
}
Pointer dataFromAddress =
Pointer.fromAddress(apduResData.address);
String message = dataFromAddress.toDartString();
debugPrint("message=$message");
await Future.microtask(() => calloc.free(apduRLen));
await Future.microtask(() => calloc.free(apduResData));
await Future.microtask(() => calloc.free(dataFromAddress));
return message;
} on ArgumentError catch (e) {
return e.toString();
} on Exception catch (e) {
return e.toString();
}
}`
Contributor guide
Assessment
This issue has not been assessed yet.