EffectScopeNode constructor

EffectScopeNode({
  1. bool detach = false,
  2. JoltDebugOption? debug,
})

Creates a scope node.

When detach is false, this scope is linked to the active subscriber so it disposes with its parent.

Implementation

EffectScopeNode({bool detach = false, JoltDebugOption? debug})
    : super(flags: ReactiveFlags.mutable) {
  assert(() {
    JoltDevTools.create(this, debug);
    return true;
  }());
  if (!detach) {
    final prevSub = getActiveSub();
    if (prevSub != null) {
      link(this, prevSub, 0);
      prevSub.flags |= ReactiveFlags.hasChildEffect;
    }
  }
}