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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

onDone or OnErr #2

Closed
hamidjalili59 opened this issue Jun 23, 2021 · 2 comments
Closed

onDone or OnErr #2

hamidjalili59 opened this issue Jun 23, 2021 · 2 comments

Comments

@hamidjalili59
Copy link

Salute bro 馃檵
Can you put an function to execute codes before disconnecting the port Like onDone() or onErr() 馃檹
These two are very useful in the serial port Thanks 馃グ

@FengChendian
Copy link
Owner

emm... Do you mean port.close().onError((error){}).onDone((){}) which like stream?

I can try it, but I'm not very familiar with Stream or implementing Stream like function. Maybe it will take some time.

@FengChendian
Copy link
Owner

done

port.closeOnListen(
  onListen: () => print(port.isOpened),
)
  ..onError((err) {
    print(err);
  })
  ..onDone(() {
    print("is closed");
    print(port.isOpened);
  });

I did't test onError because I think it can work.

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

No branches or pull requests

2 participants