# FlavoredComponentActionRegistrar

# FlavoredComponentActionRegistrar

```
@Incubating interface FlavoredComponentActionRegistrar<ComponentT> : BuildTypedComponentActionRegistrar<ComponentT> where ComponentT : ActionableComponentObject, ComponentT : ComponentIdentity
```

|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [com.android.build.api.component.FlavoredComponentActionRegistrar](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/component/FlavoredComponentActionRegistrar#) |

Allows registering Actions on ComponentT, with the ability to include filters to target sub sets of ComponentT.

This registrar only offers product flavors and build type of[ComponentIdentity](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/component/ComponentIdentity)as filters.

Calls can be chained to include more than one filters, though in some cases, selecting a particular filter can reduce the list of available filters in the chain.

## Summary

|                                                                                                                                                                                                                                                                                                                                                    ### Public methods                                                                                                                                                                                                                                                                                                                                                    ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| abstract[BuildTypedComponentActionRegistrar](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/component/BuildTypedComponentActionRegistrar)\<ComponentT\> | [withBuildType](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/component/FlavoredComponentActionRegistrar#withBuildType(kotlin.String))`(`buildType:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Filters ComponentT instances using a build type reference.                                                                                                                                                                                   |
| abstract[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                        | [withBuildType](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/component/FlavoredComponentActionRegistrar#withBuildType(kotlin.String,%20org.gradle.api.Action))`(`buildType:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `action:` `[Action](https://docs.gradle.org/current/javadoc/org/gradle/api/Action.html)<ComponentT>`)` Specifies the build type this filter should apply when filtering variants.                                    |
| abstract[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                        | [withBuildType](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/component/FlavoredComponentActionRegistrar#withBuildType(kotlin.String,%20kotlin.Function1))`(`buildType:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `action:` `ComponentT.()` `->` `[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)`)` Filters ComponentT instances using a build type reference and run a lambda of all the filtered instances. |

| ### Inherited functions ||
|---|---|
| From class[BuildTypedComponentActionRegistrar](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/component/BuildTypedComponentActionRegistrar) |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                      | [withFlavor](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/component/BuildTypedComponentActionRegistrar#withFlavor(kotlin.Pair,%20org.gradle.api.Action))`(`flavorToDimension:` `[Pair](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-pair/index.html)<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html),` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)>`, `action:` `[Action](https://docs.gradle.org/current/javadoc/org/gradle/api/Action.html)<ComponentT>`)` <br /> Filters ComponentT instances with a flavor <br />     | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                      | [withFlavor](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/component/BuildTypedComponentActionRegistrar#withFlavor(kotlin.Pair,%20kotlin.Function1))`(`flavorToDimension:` `[Pair](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-pair/index.html)<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html),` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)>`, `action:` `ComponentT.()` `->` `[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)`)` <br /> Filters ComponentT instances with a flavor <br /> | | [BuildTypedComponentActionRegistrar](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/component/BuildTypedComponentActionRegistrar)<ComponentT> | [withFlavor](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/component/BuildTypedComponentActionRegistrar#withFlavor(kotlin.Pair))`(`flavorToDimension:` `[Pair](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-pair/index.html)<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html),` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)>`)` <br /> Filters ComponentT instances with a flavor, and return the same filter instance for further product flavor filtering. <br />                                                         | ||

## Public methods

### withBuildType

```
abstract fun withBuildType(buildType: String): BuildTypedComponentActionRegistrar<ComponentT>
```

Filters ComponentT instances using a build type reference.

|                                                     Parameters                                                      ||
|--------------------------------------------------------------------------------------------|-------------------------|
| buildType:[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | to filter ComponentT on |

| Return ||
|---|---|
| an instance of[BuildTypedComponentActionRegistrar](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/component/BuildTypedComponentActionRegistrar)to further filter variants. ||

### withBuildType

```
abstract fun withBuildType(
    buildType: String, 
    action: Action<ComponentT>
): Unit
```

Specifies the build type this filter should apply when filtering variants.  

### withBuildType

```
abstract fun withBuildType(
    buildType: String, 
    action: ComponentT.() -> Unit
): Unit
```

Filters ComponentT instances using a build type reference and run a lambda of all the filtered instances.

|                                                                     Parameters                                                                     ||
|-----------------------------------------------------------------------------------------------------|-----------------------------------------------|
| buildType:[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)          | to filter ComponentT on                       |
| action:ComponentT.()-\>[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | lambda function to run on filtered ComponentT |