addControl method
Add a control if it isn't already found in the container.
Implementation
@override
void addControl(NgControl dir) {
var container = findContainer(dir.path!)!;
var ctrl = container.find(dir.name);
if (ctrl == null) {
ctrl = Control();
container.addControl(dir.name, ctrl);
}
// Binding values may change of of directive due to adding control value.
// Perform the update in the next event loop.
scheduleMicrotask(() {
setUpControl(ctrl as Control, dir);
ctrl.updateValueAndValidity(emitEvent: false);
changeDetectorRef.markForCheck();
});
}