IdGenerator constructor
Use refDate
to configure reference date to compute time part of the id.
Use workerId to maintain uniqueness when concurrent generators are used.
Implementation
IdGenerator({this.workerId = 0, DateTime? refDate})
: refDate = refDate ?? DateTime(2019).toUtc(),
_rand = Random.secure() {
_startTimestamp =
(DateTime.now().toUtc().difference(this.refDate)).inMinutes;
}