ObjectId class Null safety

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
read-only
date DateTime
The timestamp as a DateTime instance.
read-only
hashCode int
The hash code for this object. [...]
read-only, override
machineId int
The machine identifier.
read-only
processId int
The process identifier.
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
timestamp int
The timestamp. (number of seconds since the Unix epoch).
read-only

Methods

compareTo(ObjectId other) int
Compares this object to another object. [...]
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent 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.