ObjectId.fromHexString constructor

ObjectId.fromHexString(
  1. String hexString
)

Implementation

factory ObjectId.fromHexString(String hexString) {
  if (!isValidHexId(hexString)) {
    throw ArgumentError(
        'Expected hexadecimal string with length of 24, got $hexString');
  }
  return ObjectId._(BsonBinary.fromHexString(hexString));
}