addItem method
add an IdentityItem
to this IdentityMap
Implementation
void addItem(IdentityItem item, String namespace) {
if (item.id.isEmpty) {
return;
}
///add item to the existing namespace
IdentityItem itemCopy = _copyItem(item);
if (this.identityMap[namespace] != null) {
int index = this
.identityMap[namespace]!
.indexWhere((element) => _equalIds(element.id, itemCopy.id));
if (index != -1) {
this.identityMap[namespace]![index] = itemCopy;
} else
[this.identityMap[namespace]!.add(itemCopy)];
} else {
this.identityMap[namespace] = [itemCopy];
}
}