debugAssertConsistent method
void
debugAssertConsistent()
Debug: verify per-nid data slots match the registry. Throws
StateError on inconsistency. Wrapped in assert at call sites so
release builds pay nothing.
Implementation
void debugAssertConsistent() {
if (_dataByNid.length != nids.length) {
throw StateError(
"_dataByNid size ${_dataByNid.length} != registry size ${nids.length}",
);
}
for (int nid = 0; nid < nids.length; nid++) {
final key = nids.keyOf(nid);
if (key == null) continue;
if (_dataByNid[nid] == null) {
throw StateError("nid $nid for key $key has null data slot");
}
}
nids.debugAssertConsistent();
}