Open Kapish26 opened 2 years ago
Emm... I think it's due to open function in tap property. Hot reload may reload open function again. But you have opened this port or you don't have any available port. So open is failed.
Maybe you can use if condition to judge open status and port list.
And about last error is 0, it's a bug due to VM. Last error is always 0. So we don't know real error code. Refer to https://github.com/timsneath/win32/issues/189
Here is code of line 169 in serial port. It's open exception and it's always fallback to last statement (if VM bug not fixed)
if (lastError == ERROR_FILE_NOT_FOUND) {
throw Exception(_portNameUtf16.toDartString() + "is not available");
} else {
throw Exception('Last error is $lastError');
}
By the way, I think the simple way is to use try catch block to ignore this exception. Because last error is always zero...
Getting this error on hot restarting!!! Please help