---
title: "ModifierLocal"
description: "[ModifierLocal]s provide a means of inter-modifier communication. When a modifier provides a
[ModifierLocal], it is available to modifiers on the right of the providing modifier for the
current layout node. The provided [ModifierLocal]s are also available to layout nodes that are
children of the current layout node.

One must create a [ModifierLocal] instance, which can be referenced by consumers statically.
[ModifierLocal] instances themselves hold no data, and can be thought of as a type-safe
identifier for the data being passed to other modifiers to the right of the providing modifier or
down the tree. [ModifierLocal] factory functions take a single parameter: a factory to create a
default value in cases where a [ModifierLocal] is used without a Provider. If this is a situation
you would rather not handle, you can throw an error in this factory.

To add a value that can be accessed by other modifiers, create an instance of a
[ProvidableModifierLocal] and add it to the tree by using a [modifierLocalProvider]. Now other
modifiers can access the provided value by using a [modifierLocalConsumer]."
type: "class"
---

<div class='type'>Class</div>


<a id='references'></a>

<div class='sourceset sourceset-common'>Common</div>


```kotlin
sealed class ModifierLocal<T> constructor(internal val defaultFactory: () -> T)
```


`ModifierLocal`s provide a means of inter-modifier communication. When a modifier provides a
`ModifierLocal`, it is available to modifiers on the right of the providing modifier for the
current layout node. The provided `ModifierLocal`s are also available to layout nodes that are
children of the current layout node.

One must create a `ModifierLocal` instance, which can be referenced by consumers statically.
`ModifierLocal` instances themselves hold no data, and can be thought of as a type-safe
identifier for the data being passed to other modifiers to the right of the providing modifier or
down the tree. `ModifierLocal` factory functions take a single parameter: a factory to create a
default value in cases where a `ModifierLocal` is used without a Provider. If this is a situation
you would rather not handle, you can throw an error in this factory.

To add a value that can be accessed by other modifiers, create an instance of a
`ProvidableModifierLocal` and add it to the tree by using a `modifierLocalProvider`. Now other
modifiers can access the provided value by using a `modifierLocalConsumer`.



