# ifUnique method

Future<void> ifUnique(

1. Consumer<ObjectHolder<T>> consumer

)

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);
      }
    }