Atom constructor

Atom({
  1. String? name,
  2. dynamic onObserved()?,
  3. dynamic onUnobserved()?,
  4. ReactiveContext? context,
})

Creates a simple Atom for tracking its usage in a reactive context. This is useful when you don't need the value but instead a way of knowing when it becomes active and inactive in a reaction.

Use the onObserved and onUnobserved handlers to know when the atom is active and inactive respectively. Use a debug name to identify easily.

Implementation

factory Atom({
  String? name,
  Function()? onObserved,
  Function()? onUnobserved,
  ReactiveContext? context,
}) => Atom._(
  context ?? mainContext,
  name: name,
  onObserved: onObserved,
  onUnobserved: onUnobserved,
);