ifUnique method
Executes consumer only if exactly one instance is available.
- NoUniquePodDefinitionException if more than one matching object exists.
Implementation
Future<void> ifUnique(Consumer<ObjectHolder<T>> consumer) async {
final dependency = await getIfUnique();
if (dependency != null) {
consumer.call(dependency);
}
}