# KeepAlive class final

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());
    }

Implemented types
  - ApplicationEventListener<ApplicationContextEvent>

## Constructors

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

## Properties

completer ↔ Completer<void>
  Internal completer used to block the thread until shutdown.
  getter/setter pair
hashCode → int
  The hash code for this object.
  no setter inherited
runtimeType → Type
  A representation of the runtime type of the object.
  no setter inherited

## Methods

noSuchMethod(Invocation invocation) → dynamic
  Invoked when a nonexistent method or property is accessed.
  inherited
onApplicationEvent(ApplicationContextEvent event) → void
  Handle an application event of type `E`.
  override
startKeepAliveThread() → void
  Starts the keep-alive thread by awaiting an uncompleted Completer.
stopKeepAliveThread() → void
  Stops the keep-alive thread, allowing the application to shut down.
supportsEventOf(ApplicationEvent event) → bool
  Returns true if the listener supports the given event.
  override
toString() → String
  A string representation of this object.
  inherited

## Operators

operator ==(Object other) → bool
  The equality operator.
  inherited