UuidV1Generator.fromLastUuid constructor
Creates a new instance of a generator from a previously generated uuid
.
Both Uuid.node and Uuid.clock are used.
If Uuid.time is ahead of now
, the clock sequence is increased.
Implementation
factory UuidV1Generator.fromLastUuid(
Uuid uuid, {
DateTime Function() now = DateTime.now,
}) {
if (uuid.version != UuidVersion.v1) {
throw ArgumentError.value(uuid.version, 'version', 'UUID is not v1');
}
var clockSequence = uuid.clock;
if (uuid.time!.compareTo(now()) > 0) {
clockSequence++;
clockSequence &= 0x3fff;
}
return UuidV1Generator._(uuid.node, clockSequence, now);
}