Atom<T> constructor

Atom<T>({
  1. required T defaultValue,
  2. required String key,
})

Constructor that returns a new atom. defaultValue the default value of this Atom, used to avoid setting null as the default value. key a globally unique key that identifies this Atom.

Returns the newly created Atom.

Implementation

Atom({required T defaultValue, required String key}) : key = key {
  setState(defaultValue);
}