Lifespan.dynamic constructor

Lifespan.dynamic(
  1. int ttl, [
  2. Clock clock = Clock.system
])

Creates dynamic validator that will change it's EntityValidator.isValid in time ttl Time to live clock Clock implementation

Implementation

factory Lifespan.dynamic(int ttl, [ Clock clock = Clock.system ]) {
  final wasBorn = clock.getMillis();
  return Lifespan._private(
      wasBorn,
      ttl,
      _DynamicValidation(clock)
  );
}