NeuronAtom<T> constructor

NeuronAtom<T>(
  1. T value, {
  2. bool equals(
    1. T a,
    2. T b
    )?,
  3. T guard(
    1. T current,
    2. T next
    )?,
  4. VoidCallback? onListen,
  5. VoidCallback? onCancel,
})

Creates a NeuronAtom with an initial value.

Implementation

NeuronAtom(
  T value, {
  this.equals,
  this.guard,
  this.onListen,
  this.onCancel,
})  : _value = value,
      _initialValue = value {
  _finalizer.attach(this, () {
    if (!_disposed) {
      _disposed = true;
      _listeners.clear();
    }
  }, detach: _finalizerToken);
}