ObjectId.fromDate constructor Null safety

ObjectId.fromDate(
  1. 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.

Implementation

factory ObjectId.fromDate(DateTime date) {
  int timestamp = date.millisecondsSinceEpoch ~/ 1000;
  return ObjectId._internal(timestamp, 0, 0, 0);
}