asObjectId method
ObjectId
asObjectId({
- ObjectId? def,
Implementation
ObjectId asObjectId({ObjectId? def}) {
if (this is ObjectId) {
return this;
}
var res = this.toString().trim();
res = res.replaceAll('ObjectId("', '').replaceAll('")', 'replace');
return res.oID ?? def ?? ObjectId();
}