Nuid class
Nuid means NATS UID
NATS is a communication protocol and need an optimized way to generate UIDs for the protocol.
The Nuid is an implementation of the NUID
algorithm based of
the Node.js nuid package
final nuid = Nuid.instance;
print('String:');
print(' First nuid:');
for (var i = 0; i < 4; i++) {
print(' - ${nuid.next()}');
}
print(' Reseting nuid:');
nuid.reset();
for (var i = 0; i < 4; i++) {
print(' - ${nuid.next()}');
}
print('\nBytes:');
print(' First nuid:');
for (var i = 0; i < 4; i++) {
print(' - ${nuid.nextBytes()}');
}
print(' Reseting nuid:');
nuid.reset();
for (var i = 0; i < 4; i++) {
print(' - ${nuid.nextBytes()}');
}
Properties
Methods
-
next(
) → String - Returns the next Nuid
-
nextBytes(
) → List< int> - Returns the next Nuid as a List<int>
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reset(
[bool seqInc = true]) → void - Initializes or reinitializes a nuid with a crypto random prefix, and pseudo-random sequence and increment.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited