activate method

  1. @mustCallSuper
void activate()

Transition from the "inactive" to the "active" lifecycle state.

The framework calls this method when a previously deactivated element has been reincorporated into the tree. The framework does not call this method the first time an element becomes active (i.e., from the "initial" lifecycle state). Instead, the framework calls mount in that situation.

Implementations of this method should start with a call to the inherited method, as in super.activate().

Implementation

@mustCallSuper
void activate() {
  assert(_lifecycleState == _ElementLifecycle.inactive);
  assert(_component != null);
  assert(_owner != null);
  assert(_binding != null);
  assert(_parent != null);
  assert(_depth != null);
  final bool hadDependencies = (_dependencies != null && _dependencies!.isNotEmpty) || _hadUnsatisfiedDependencies;
  _lifecycleState = _ElementLifecycle.active;

  var parent = _parent!;
  _parentRenderObjectElement = parent is RenderObjectElement ? parent : parent._parentRenderObjectElement;

  _dependencies?.clear();
  _hadUnsatisfiedDependencies = false;
  _updateInheritance();
  _updateObservers();
  attachNotificationTree();
  if (_dirty) {
    owner.scheduleBuildFor(this);
  }
  if (hadDependencies) didChangeDependencies();
}