Atom<T> constructor
Null safety
- {required T defaultValue,
- 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);
}