For AI agents: the documentation index is at https://docs.gradle.org/llms.txt. Request any page with the header Accept: text/markdown to get Markdown. User manual pages are also available as Markdown by replacing .html with .md in the URL.

filter

abstract fun filter(spec: Spec<in T>): Provider<T>(source)

Returns a new Provider with the value of this provider if the passed spec is satisfied and no value otherwise.

The resulting provider will be live, so that each time it is queried, it queries the original (this) provider and applies the spec to the result. Whenever the original provider has no value, the new provider will also have no value and the spec will not be called.

Since

8.5

Parameters

spec

The spec to test the value.