isMongoId function

bool isMongoId(
  1. String str
)

Checks if the string is a valid MongoDB ObjectId.

A MongoDB ObjectId is a 24-character hexadecimal string.

Example:

isMongoId('507f1f77bcf86cd799439011'); // true
isMongoId('507f1f77bcf86cd79943901'); // false (too short)
isMongoId('zzzf1f77bcf86cd799439011'); // false

Implementation

bool isMongoId(String str) => _isMongoId(str);