next property

  1. @override
int next
override

Alias for get without source.

Implementation

@override
int get next {
  int generate() => type == TimeIdType.milliseconds
      ? DateTime.now().millisecondsSinceEpoch
      : DateTime.now().microsecondsSinceEpoch;

  /// we need this for guarantee a next ID not equals to previous call [next]
  final prev = generate();
  for (;;) {
    final t = generate();
    if (t != prev) {
      return t;
    }
  }
}