addDependent method Null safety

bool addDependent(
  1. Component dependent,
  2. {Component? via}
)
inherited

Mark dependent as a component which must update after this. Provide via as the Component registering the dependency when it is not dependent itself. At edit time this allows the editor to rebuild both dependent and via when dependent has its dependencies cleared.

Implementation

bool addDependent(Component dependent, {Component? via}) {
  assert(artboard == dependent.artboard,
      'Components must be in the same artboard.');

  if (!_dependents.add(dependent)) {
    return false;
  }
  dependent._dependsOn.add(this);

  return true;
}