add method
Records a newly cached id. Returns false when it was already present.
Implementation
bool add(String id, int byteLength) {
if (byteLength < 0) {
throw ArgumentError.value(
byteLength,
'byteLength',
'must be non-negative',
);
}
if (_byteLengths.containsKey(id)) return false;
_byteLengths[id] = byteLength;
_totalBytes += byteLength;
return true;
}