addObjectInScope method
void
addObjectInScope({})
Adds object to given scoped collection
Implementation
void addObjectInScope({
required T object,
required String type,
required String scopeId,
bool overrideMainInstance = false,
}) {
if (_instances.containsKey(scopeId)) {
final scope = _instances[scopeId]!;
if (scope[type] == null) {
_instances[scopeId]![type] = [object];
} else {
if (overrideMainInstance) {
_instances[scopeId]![type] = [object];
} else {
_instances[scopeId]![type]?.add(object);
}
}
} else {
_instances[scopeId] = HashMap.from({
type: [object],
});
}
}