getAtom<T> method Null safety

Atom<T>? getAtom<T>(
  1. String key

Gets an Atom from the store. key the key of the Atom to get.

Returns the Atom with the key key from the store if it exist and if the Atom is of the type Atom


Atom<T>? getAtom<T>(String key) {
  if (!_atoms.containsKey(key)) {
    return null;

  var atom = _atoms[key];

  if (atom is! Atom<T>) {
    return null;

  return _atoms[key] as Atom<T>;