addAtom<T> method
Adds an Atom to the store.
atom
is the Atom to be added to the store.
Returns the Atom added to the store if no Atom with the same key exists, otherwise returns null.
Implementation
Atom<T>? addAtom<T>(Atom<T> atom) {
if (_atoms.containsKey(atom.key)) {
return null;
}
return _atoms.putIfAbsent(atom.key, () => atom) as Atom<T>;
}