KeepAlive constructor

KeepAlive()

A lifecycle-aware component that keeps the Dart VM alive as long as the ApplicationContext is running.

This is useful for command-line or server-based JetLeaf applications that would otherwise terminate after context initialization.

The keep-alive mechanism listens to ApplicationContextEvents and starts an internal blocking thread on ContextRefreshedEvent, and releases it on ContextClosedEvent.


Example

void main() {
  final context = JetLeaf.run();
  context.addApplicationListener(KeepAlive());
}

Implementation

KeepAlive();