-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Serial Port is not disposed correctly during a flutter hot restart #68
Comments
Same for me, sorry @bryceremick how do you run the package under Android? It does not work for me, I always have an issue related to permissions. Thanks for any help. |
Hi @bryceremick, do you find any solution? I also getting this error in ubuntu. |
@hareendranmg I have not found any solution for this yet, unfortunately. Hot reload is working for me, but not hot restart. |
I believe the reason for this issue is that Flutter performs a hot restart, which restarts the entire application, causing the |
Same for windows. After hot restart serialPort.dispose() is not called and no way to reopen port |
I have solved this problem. You can save the address of the last opened serial port. When hot restart occurs, check for any serial port addresses that have not been properly closed in the main function. If they exist, create a SerialPort by constructing the SerialPort. freeAddress method, then close and dispose of them |
@shingohu |
|
Anytime I do a hot restart on my flutter app after the port has been initialized, I get this error:
Unhandled Exception: SerialPortError: Device or resource busy, errno = 16
Basically my app runs through this initialization process during every hot restart:
I get this error at step 3 after a hot restart.
My guess is that the port is not disposed correctly and when a new port gets opened for read/write the OS throws this error because the old port still exists in memory.
This is on Android 7.1 btw.
Any suggestions on how to solve this?
Thanks
The text was updated successfully, but these errors were encountered: