componentsNotifier<T extends Component> method
Returns a ComponentsNotifier for the given type T
.
This method handles duplications, so there will never be more than one ComponentsNotifier for a given type, meaning that this method can be called as many times as needed for a type.
Implementation
ComponentsNotifier<T> componentsNotifier<T extends Component>() {
for (final notifier in notifiers) {
if (notifier is ComponentsNotifier<T>) {
return notifier;
}
}
final notifier = ComponentsNotifier<T>(
descendants().whereType<T>().toList(),
);
notifiers.add(notifier);
return notifier;
}