ObjectId class

A globally unique identifier for objects.

Consists of 12 bytes, divided as follows:

  • time (4 bytes)
  • machine (3 bytes)
  • pid (2 bytes)
  • inc (3 bytes)
Implemented types

Constructors

ObjectId()
Creates a new object id.
factory
ObjectId.fromBytes(List<int?>? bytes)
Creates a new instance from the given byte list.
factory
ObjectId.fromDate(DateTime date)
Creates a new instance from the given date, with the rest of the ObjectId zeroed out. Used for comparisons or sorting the ObjectId.
factory
ObjectId.fromHexString(String? hexString)
Creates a new instance from a 24-byte hexadecimal string representation.
factory

Properties

counter int
The counter
no setter
date DateTime
The timestamp as a DateTime instance.
no setter
hashCode int
The hash code for this object.
no setteroverride
machineId int
The machine identifier.
no setter
processId int
The process identifier.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
timestamp int
The timestamp. (number of seconds since the Unix epoch).
no setter

Methods

compareTo(ObjectId other) int
Compares this object to another object.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toBytes() List<int?>
Converts to a byte list. Note that the numbers are stored in big-endian order.
toHexString() String
Converts this instance into 24-byte hexadecimal string representation.
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override

Static Methods

isValid(String? hexString) bool
Checks if a string could be an ObjectId. Throws an ArgumentError if hexString is null.