ApplicationEvent.withClock constructor

ApplicationEvent.withClock(
  1. Object source,
  2. DateTime clock()
)

Creates a new ApplicationEventconst using a custom clock function.

This is useful for testing or fine-grained control over timestamps.

Example:

final fixedClock = () => DateTime.utc(2023, 1, 1);
final event = ApplicationEvent.withClock(appContext, fixedClock);

Implementation

ApplicationEvent.withClock(Object source, DateTime Function() clock) : super(source, clock());