# attributeProvider

abstract fun <T> attributeProvider(key: Attribute<T>, provider: Provider<out T>): AttributeContainer(source)

Sets an attribute to have the same value as the given provider. This attribute will track the value of the provider and query its value when this container is finalized.

This method can NOT be used to discard the value of an property. Specifying a `null` provider will result in an `IllegalArgumentException` being thrown. When the provider has no value at finalization time, an `IllegalStateException` - regardless of whether or not a convention has been set.

#### Return

this container

#### Since

7.4

#### Parameters

<T>

the type of the attribute

key

the attribute key

provider

The provider whose value to use