Uuid class final

Represents a RFC 4122 UUID. More generally, any 128-bit byte sequence can be represented by this class, but the semantics for the fields described in the may not apply for other variants.

Instances follow the rules for equivalence and ordering laid out by the RFC.

Implemented types
Available extensions
Annotations
  • @immutable

Constructors

Uuid.fromBytes(Uint8List uuidBytes)
Construct a UUID from the given byte list.
factory
Uuid.fromString(String uuidString)
Parses a UUID from the given String.
factory
Uuid.v1({int? nodeId})
Generates a v1 (time-based) UUID.
factory
Uuid.v4({Random? random})
Generates a v4 (random) UUID.
factory
Uuid.v5({required Uuid namespace, required String name})
Generates a v5 (name-based with SHA-1) UUID.
factory
Uuid.v6({int? nodeId})
Generates a v6 (time-based) UUID as defined by RFC 9562.
factory

Properties

bytes Uint8List
The raw bytes of this UUID. The returned Uint8List is unmodifiable and contains exactly 16 bytes.
final
clockSequence int
The combined clock sequence. Note that the semantics of this value differ between UUID versions. For v4 UUIDs in particular, this is a random value.
no setter
clockSequenceHigh int
The high field of the clock sequence without the variant.
no setter
clockSequenceHighAndReserved int
The high field of the clock sequence multiplexed with the variant.
no setter
clockSequenceLow int
The low field of the clock sequence.
no setter
hashCode int
The hash code for this object.
no setteroverride
node int
The spatially unique node identifier.
no setter
parsedTime DateTime
The parsed time as a usable DateTime object.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
time int
The full "timestamp" of the UUID. Note that parsedTime provides a parsed version of this timestamp, albeit only for v1 and v6 UUIDs.
no setter
timeHigh int
The high field of the timestamp without the version number that was originally multiplexed into timeHighAndVersion.
no setter
timeHighAndVersion int
The high field of the timestamp multiplexed with the version number, i.e. octets 6-7. For v4 UUIDs, the timestamp will be random, but the version bits will be 4 (0b0100).
no setter
timeLow int
The low field of the timestamp, i.e. octets 0-3. This field will be random for v4 UUIDs.
no setter
timeMid int
The mid field of the timestamp, i.e. octets 4-5. This field will be random for v4 UUIDs.
no setter
variant → UuidVariant
The UUID variant which determines the layout of the UUID.
no setter
version int
The version that was originally multiplexed in timeHighAndVersion.
no setter

Methods

compareTo(Uuid other) int
Compares this object to another object.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
Returns the string representation of this UUID as specified by RFC 4122.
override

Operators

operator <(Uuid other) bool
operator <=(Uuid other) bool
operator ==(Object other) bool
The equality operator.
override
operator >(Uuid other) bool
operator >=(Uuid other) bool

Static Properties

max Uuid
The max UUID is a special form of UUID that is specified to have all 128 bits set to one (ffffffff-ffff-ffff-ffff-ffffffffffff).
final
nil Uuid
The nil UUID is a special form of UUID that is specified to have all 128 bits set to zero (00000000-0000-0000-0000-000000000000).
final