increaseReferencesInScope method
Adds 1 to references for given type
Implementation
void increaseReferencesInScope(String scopeId, Type type, {int index = 0}) {
if (_references.containsKey(scopeId)) {
final typesCounts = _references[scopeId]!;
if (typesCounts.containsKey(type)) {
if (index < 0 || index > typesCounts[type]!.length) {
throw IllegalArgumentException(
message:
'The index = $index value must be non-negative and no greater than count of references of $type in $scopeId.',
);
}
if (typesCounts[type]!.length == index) {
typesCounts[type]!.insert(index, 1);
} else {
typesCounts[type]![index] = typesCounts[type]![index] + 1;
}
} else {
typesCounts[type] = [1];
}
} else {
_references[scopeId] = HashMap.from({
type: [1],
});
}
}