Skip to content
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

Add finalizers #84

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

alexbatalov
Copy link

This PR adds finalizers to native objects. Note that I'm using sp_close as a SerialPort finalizer which is much more important than sp_free_port since it allows to re-open serial port after Flutter's Hot Restart.

While it's perfectly fine to have more than one native finalizer for the same object, Dart SDK does not make guarantees about their execution order. So if you try to add sp_free_port finalizer as well, it might be called before sp_close finalizer (depending on the environment or Dart SDK version). Ideally underlying libserialport will have something like sp_dispose with deterministic order (close and free).

Closes #68

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Serial Port is not disposed correctly during a flutter hot restart
1 participant