registerShutdownHook property

bool registerShutdownHook
final

Whether the context is closed cleanly when the process gets SIGINT (Ctrl+C) or SIGTERM, so @PreDestroy methods and ContextClosedEvent listeners run before the process ends.

Turn it on in programs that run until they are stopped, such as servers. It is off by default, unlike in Spring Boot: listening for signals keeps a Dart program alive, so a program that has finished its work would never end. The property spring.main.register-shutdown-hook wins when set. It uses the context's registerShutdownHook() and does nothing without dart:io (on the web).

Implementation

final bool registerShutdownHook;