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
Constructors
- KeepAlive()
- A lifecycle-aware component that keeps the Dart VM alive as long as the ApplicationContext is running.
Properties
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