Lifespan.snapshot constructor

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

Creates a snapshot that may be serialized and deserialized back to dynamic Lifespan ttl Time to live clock Clock implementation

Implementation

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