ApplicationEvent constructor
A base class for application-specific events within the JetLeaf framework.
Extends EventObject and allows capturing the event creation time using either the system clock or a custom clock function.
Subclasses of ApplicationEvent are used to represent meaningful events in the lifecycle of an application, such as context initialization, refresh, shutdown, etc.
Example
class ContextRefreshedEvent extends ApplicationEvent {
ContextRefreshedEvent(Object source) : super(source);
}
final event = ContextRefreshedEvent(appContext);
print(event.source); // appContext
print(event.timestamp); // time of creation
Creates a new ApplicationEvent with the system clock as timestamp.
Uses DateTime.now()
by default.
Implementation
/// Creates a new [ApplicationEvent] with the system clock as timestamp.
///
/// Uses `DateTime.now()` by default.
const ApplicationEvent(super.source, [super.timestamp]);