attachTo method

  1. @mustCallSuper
void attachTo(
  1. Object instance
)
inherited

Attaches an object instance to this state.

Implementation

@mustCallSuper
void attachTo(Object instance) {
  assert(
    _instanceAttached == null,
    "Can't attach a new instance because an instance is already.\n"
    "Use `detachInstance` method, if you want to attach a new instance.",
  );

  Reactter.one(instance, Lifecycle.destroyed, _onInstanceDestroyed);
  _instanceAttached = instance;
}