Is there a way to do something just before the Darts application running on exit from the VM?
I am writing a server application, so there is no specific moment when my application will exit. I'm trying to talk to another process, but if the user closes my application (using ctr + c) or crashes for some unknown reason, I would like to be able to say that the process is also closing.
It would be nice if something like this existed:
void main() { onExit().then(() { process.kill(); }); }
Thanks.
Edit:
I figured out how to detect Ctr+C :
void main() { ProcessSignal.SIGINT.watch().listen((ProcessSignal signal) { print("exiting"); exit(0); }); }
Now, if the application starts from the Dart editor, is there a way to detect this closure?
events dart exit
Michael peterson
source share