isValid static method

bool isValid(
  1. String? hexString
)

Checks if a string could be an ObjectId. Throws an ArgumentError if hexString is null.

Implementation

static bool isValid(String? hexString) {
  if (hexString == null) {
    throw ArgumentError.notNull('hexString');
  }

  return hexString.length == 24 && _checkForHexRegExp.hasMatch(hexString);
}