blob: 3c6d544df3adfec6fa854aa7fa398ecd6b8a2531 [file] [log] [blame]
<html devsite="true">
<head>
<title>SnapshotMutableState</title>
{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %}
{% include "_shared/_reference-head-tags.html" %}
</head>
<body>
<div id="metadata-info-block"></div>
<h1>SnapshotMutableState</h1>
<p>
<pre>public interface <a href="/reference/androidx/compose/runtime/snapshots/SnapshotMutableState.html">SnapshotMutableState</a>&lt;T&nbsp;extends&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&gt; extends <a href="/reference/androidx/compose/runtime/MutableState.html">MutableState</a></pre>
</p>
<hr>
<p>A mutable value holder where reads to the <code><a href="/reference/androidx/compose/runtime/snapshots/SnapshotMutableState.html#value()">value</a></code> property during the execution of a <code><a href="/reference/androidx/compose/runtime/Composable.html">Composable</a></code> function, the current <code><a href="/reference/androidx/compose/runtime/RecomposeScope.html">RecomposeScope</a></code> will be subscribed to changes of that value. When the <code><a href="/reference/androidx/compose/runtime/snapshots/SnapshotMutableState.html#value()">value</a></code> property is written to and changed, a recomposition of any subscribed <code><a href="/reference/androidx/compose/runtime/RecomposeScope.html">RecomposeScope</a></code>s will be scheduled. Writes to it are transacted as part of the <code><a href="/reference/androidx/compose/runtime/snapshots/Snapshot.html">Snapshot</a></code> system.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="100%">See also</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code><a href="/reference/androidx/compose/runtime/State.html">State</a></code></td>
<td></td>
</tr>
<tr>
<td width="40%"><code><a href="/reference/androidx/compose/runtime/MutableState.html">MutableState</a></code></td>
<td></td>
</tr>
<tr>
<td width="40%"><code><a href="/reference/androidx/compose/runtime/package-summary.html#mutableStateOf(kotlin.Any,androidx.compose.runtime.SnapshotMutationPolicy)">mutableStateOf</a></code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<h2>Summary</h2>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="100%"><h3>Public fields</h3></th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code>abstract @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/runtime/SnapshotMutationPolicy.html">SnapshotMutationPolicy</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T&gt;</code></td>
<td>
<div><code><a href="/reference/androidx/compose/runtime/snapshots/SnapshotMutableState.html#policy()">policy</a></code></div>
<p>A policy to control how changes are handled in a mutable snapshot.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive" id="inhmethods">
<thead>
<tr>
<th colspan="100%"><h3>Inherited fields</h3></th>
</tr>
</thead>
<tbody class="list">
<tr>
<td><devsite-expandable><span class="expand-control">From <a href="/reference/androidx/compose/runtime/MutableState.html">androidx.compose.runtime.MutableState</a></span>
<div class="devsite-table-wrapper">
<table class="responsive">
<tbody class="list">
<tr>
<td width="40%"><code>abstract @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T</code></td>
<td>
<div><code><a href="/reference/androidx/compose/runtime/MutableState.html#value()">value</a></code></div>
</td>
</tr>
</tbody>
</table>
</div>
</devsite-expandable> </td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive" id="inhmethods">
<thead>
<tr>
<th colspan="100%"><h3>Inherited methods</h3></th>
</tr>
</thead>
<tbody class="list">
<tr>
<td><devsite-expandable><span class="expand-control">From <a href="/reference/androidx/compose/runtime/MutableState.html">androidx.compose.runtime.MutableState</a></span>
<div class="devsite-table-wrapper">
<table class="responsive">
<tbody class="list">
<tr>
<td width="40%"><code>abstract @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T</code></td>
<td>
<div><code><a href="/reference/androidx/compose/runtime/MutableState.html#component1()">component1</a>()</code></div>
</td>
</tr>
<tr>
<td width="40%"><code>abstract @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function1&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T,&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a>&gt;</code></td>
<td>
<div><code><a href="/reference/androidx/compose/runtime/MutableState.html#component2()">component2</a>()</code></div>
</td>
</tr>
</tbody>
</table>
</div>
</devsite-expandable> </td>
</tr>
</tbody>
</table>
</div>
<h2>Public fields</h2>
<div><a name="getPolicy()"></a><a name="setPolicy()"></a><a name="getPolicy--"></a><a name="setPolicy--"></a>
<h3 class="api-name" id="policy()">policy</h3>
<pre class="api-signature no-pretty-print">abstract&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/runtime/SnapshotMutationPolicy.html">SnapshotMutationPolicy</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T&gt;&nbsp;<a href="/reference/androidx/compose/runtime/snapshots/SnapshotMutableState.html#policy()">policy</a></pre>
<p>A policy to control how changes are handled in a mutable snapshot.</p>
</div>
</body>
</html>