replaceComp method
Replaces the first top-level component whose runtimeType == component.runtimeType with component.
Implementation
E replaceComp(Comp<T> component) {
final old = _components.where((c) => c.runtimeType == component.runtimeType).firstOrNull;
if (old != null) _removeComponentInstance(old);
addComp(component);
return self;
}