| <html devsite="true"> |
| <head> |
| <title>SnapshotKt</title> |
| {% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} |
| {% include "_shared/_reference-head-tags.html" %} |
| </head> |
| <body> |
| <h1>SnapshotKt</h1> |
| <p> |
| <pre>public final class <a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html">SnapshotKt</a></pre> |
| </p> |
| <hr> |
| <h2>Summary</h2> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%"><h3>Public methods</h3></th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code>static final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T</code></td> |
| <td> |
| <div><code><T extends <a href="/reference/androidx/compose/runtime/snapshots/StateRecord.html">StateRecord</a>> <a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html">SnapshotKt</a>.<a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html#(androidx.compose.runtime.snapshots.StateRecord).readable(androidx.compose.runtime.snapshots.StateObject)">readable</a>(<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T receiver,<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/runtime/snapshots/StateObject.html">StateObject</a> state<br>)</code></div> |
| <p>Return the current readable state record for the current snapshot.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>static final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T</code></td> |
| <td> |
| <div><code><T extends <a href="/reference/androidx/compose/runtime/snapshots/StateRecord.html">StateRecord</a>> <a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html">SnapshotKt</a>.<a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html#(androidx.compose.runtime.snapshots.StateRecord).readable(androidx.compose.runtime.snapshots.StateObject,androidx.compose.runtime.snapshots.Snapshot)">readable</a>(<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T receiver,<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/runtime/snapshots/StateObject.html">StateObject</a> state,<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/runtime/snapshots/Snapshot.html">Snapshot</a> snapshot<br>)</code></div> |
| <p>Return the current readable state record for the <code><a href="/reference/androidx/compose/runtime/snapshots/package-summary.html#(androidx.compose.runtime.snapshots.StateRecord).readable(androidx.compose.runtime.snapshots.StateObject,androidx.compose.runtime.snapshots.Snapshot)">snapshot</a></code>.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>static final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> R</code></td> |
| <td> |
| <div><code><T extends <a href="/reference/androidx/compose/runtime/snapshots/StateRecord.html">StateRecord</a>, R extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> <a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html">SnapshotKt</a>.<a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html#(androidx.compose.runtime.snapshots.StateRecord).withCurrent(kotlin.Function1)">withCurrent</a>(<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T receiver,<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function1<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> r, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> R> block<br>)</code></div> |
| <p>Provides a <code><a href="/reference/androidx/compose/runtime/snapshots/package-summary.html#(androidx.compose.runtime.snapshots.StateRecord).withCurrent(kotlin.Function1)">block</a></code> with the current record, without notifying any read observers.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>static final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> R</code></td> |
| <td> |
| <div><code><T extends <a href="/reference/androidx/compose/runtime/snapshots/StateRecord.html">StateRecord</a>, R extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> <a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html">SnapshotKt</a>.<a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html#(androidx.compose.runtime.snapshots.StateRecord).writable(androidx.compose.runtime.snapshots.StateObject,kotlin.Function1)">writable</a>(<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T receiver,<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/runtime/snapshots/StateObject.html">StateObject</a> state,<br> @<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-extension-function-type/index.html">ExtensionFunctionType</a> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function1<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> R> block<br>)</code></div> |
| <p>Call <code><a href="/reference/androidx/compose/runtime/snapshots/package-summary.html#(androidx.compose.runtime.snapshots.StateRecord).writable(androidx.compose.runtime.snapshots.StateObject,kotlin.Function1)">block</a></code> with a writable state record for the given record.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>static final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> R</code></td> |
| <td> |
| <div><code><T extends <a href="/reference/androidx/compose/runtime/snapshots/StateRecord.html">StateRecord</a>, R extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> <a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html">SnapshotKt</a>.<a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html#(androidx.compose.runtime.snapshots.StateRecord).writable(androidx.compose.runtime.snapshots.StateObject,androidx.compose.runtime.snapshots.Snapshot,kotlin.Function1)">writable</a>(<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T receiver,<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/runtime/snapshots/StateObject.html">StateObject</a> state,<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/runtime/snapshots/Snapshot.html">Snapshot</a> snapshot,<br> @<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-extension-function-type/index.html">ExtensionFunctionType</a> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function1<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> R> block<br>)</code></div> |
| <p>Call <code><a href="/reference/androidx/compose/runtime/snapshots/package-summary.html#(androidx.compose.runtime.snapshots.StateRecord).writable(androidx.compose.runtime.snapshots.StateObject,androidx.compose.runtime.snapshots.Snapshot,kotlin.Function1)">block</a></code> with a writable state record for <code><a href="/reference/androidx/compose/runtime/snapshots/package-summary.html#(androidx.compose.runtime.snapshots.StateRecord).writable(androidx.compose.runtime.snapshots.StateObject,androidx.compose.runtime.snapshots.Snapshot,kotlin.Function1)">snapshot</a></code> of the given record.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="list"> |
| <h2>Public methods</h2> |
| <div class="api-item"><a name="-androidx.compose.runtime.snapshots.StateRecord-.readable-androidx.compose.runtime.snapshots.StateObject-"></a><a name="readable"></a> |
| <h3 class="api-name" id="(androidx.compose.runtime.snapshots.StateRecord).readable(androidx.compose.runtime.snapshots.StateObject)">SnapshotKt.readable</h3> |
| <pre class="api-signature no-pretty-print">public static final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T <T extends <a href="/reference/androidx/compose/runtime/snapshots/StateRecord.html">StateRecord</a>> <a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html">SnapshotKt</a>.<a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html#(androidx.compose.runtime.snapshots.StateRecord).readable(androidx.compose.runtime.snapshots.StateObject)">readable</a>(<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T receiver,<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/runtime/snapshots/StateObject.html">StateObject</a> state<br>)</pre> |
| <p>Return the current readable state record for the current snapshot. It is assumed that <code><a href="/reference/androidx/compose/runtime/snapshots/package-summary.html#<this>()">this</a></code> is the first record of <code><a href="/reference/androidx/compose/runtime/snapshots/package-summary.html#(androidx.compose.runtime.snapshots.StateRecord).readable(androidx.compose.runtime.snapshots.StateObject)">state</a></code></p> |
| </div> |
| <div class="api-item"><a name="(androidx.compose.runtime.snapshots.StateRecord).readable(androidx.compose.runtime.snapshots.StateObject, androidx.compose.runtime.snapshots.Snapshot)"></a><a name="-androidx.compose.runtime.snapshots.StateRecord-.readable-androidx.compose.runtime.snapshots.StateObject-androidx.compose.runtime.snapshots.Snapshot-"></a><a name="readable"></a> |
| <h3 class="api-name" id="(androidx.compose.runtime.snapshots.StateRecord).readable(androidx.compose.runtime.snapshots.StateObject,androidx.compose.runtime.snapshots.Snapshot)">SnapshotKt.readable</h3> |
| <pre class="api-signature no-pretty-print">public static final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T <T extends <a href="/reference/androidx/compose/runtime/snapshots/StateRecord.html">StateRecord</a>> <a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html">SnapshotKt</a>.<a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html#(androidx.compose.runtime.snapshots.StateRecord).readable(androidx.compose.runtime.snapshots.StateObject,androidx.compose.runtime.snapshots.Snapshot)">readable</a>(<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T receiver,<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/runtime/snapshots/StateObject.html">StateObject</a> state,<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/runtime/snapshots/Snapshot.html">Snapshot</a> snapshot<br>)</pre> |
| <p>Return the current readable state record for the <code><a href="/reference/androidx/compose/runtime/snapshots/package-summary.html#(androidx.compose.runtime.snapshots.StateRecord).readable(androidx.compose.runtime.snapshots.StateObject,androidx.compose.runtime.snapshots.Snapshot)">snapshot</a></code>. It is assumed that <code><a href="/reference/androidx/compose/runtime/snapshots/package-summary.html#<this>()">this</a></code> is the first record of <code><a href="/reference/androidx/compose/runtime/snapshots/package-summary.html#(androidx.compose.runtime.snapshots.StateRecord).readable(androidx.compose.runtime.snapshots.StateObject,androidx.compose.runtime.snapshots.Snapshot)">state</a></code></p> |
| </div> |
| <div class="api-item"><a name="-androidx.compose.runtime.snapshots.StateRecord-.withCurrent-kotlin.Function1-"></a><a name="withcurrent"></a> |
| <h3 class="api-name" id="(androidx.compose.runtime.snapshots.StateRecord).withCurrent(kotlin.Function1)">SnapshotKt.withCurrent</h3> |
| <pre class="api-signature no-pretty-print">public static final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> R <T extends <a href="/reference/androidx/compose/runtime/snapshots/StateRecord.html">StateRecord</a>, R extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> <a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html">SnapshotKt</a>.<a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html#(androidx.compose.runtime.snapshots.StateRecord).withCurrent(kotlin.Function1)">withCurrent</a>(<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T receiver,<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function1<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> r, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> R> block<br>)</pre> |
| <p>Provides a <code><a href="/reference/androidx/compose/runtime/snapshots/package-summary.html#(androidx.compose.runtime.snapshots.StateRecord).withCurrent(kotlin.Function1)">block</a></code> with the current record, without notifying any read observers.</p> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">See also</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code><a href="/reference/androidx/compose/runtime/snapshots/package-summary.html#readable(androidx.compose.runtime.snapshots.StateRecord,kotlin.Int,androidx.compose.runtime.snapshots.SnapshotIdSet)">readable</a></code></td> |
| <td></td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <div class="api-item"><a name="(androidx.compose.runtime.snapshots.StateRecord).writable(androidx.compose.runtime.snapshots.StateObject, kotlin.Function1)"></a><a name="-androidx.compose.runtime.snapshots.StateRecord-.writable-androidx.compose.runtime.snapshots.StateObject-kotlin.Function1-"></a><a name="writable"></a> |
| <h3 class="api-name" id="(androidx.compose.runtime.snapshots.StateRecord).writable(androidx.compose.runtime.snapshots.StateObject,kotlin.Function1)">SnapshotKt.writable</h3> |
| <pre class="api-signature no-pretty-print">public static final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> R <T extends <a href="/reference/androidx/compose/runtime/snapshots/StateRecord.html">StateRecord</a>, R extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> <a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html">SnapshotKt</a>.<a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html#(androidx.compose.runtime.snapshots.StateRecord).writable(androidx.compose.runtime.snapshots.StateObject,kotlin.Function1)">writable</a>(<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T receiver,<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/runtime/snapshots/StateObject.html">StateObject</a> state,<br> @<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-extension-function-type/index.html">ExtensionFunctionType</a> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function1<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> R> block<br>)</pre> |
| <p>Call <code><a href="/reference/androidx/compose/runtime/snapshots/package-summary.html#(androidx.compose.runtime.snapshots.StateRecord).writable(androidx.compose.runtime.snapshots.StateObject,kotlin.Function1)">block</a></code> with a writable state record for the given record. It is assumed that this is called for the first state record in a state object. A record is writable if it was created in the current mutable snapshot.</p> |
| </div> |
| <div class="api-item"><a name="(androidx.compose.runtime.snapshots.StateRecord).writable(androidx.compose.runtime.snapshots.StateObject, androidx.compose.runtime.snapshots.Snapshot, kotlin.Function1)"></a><a name="-androidx.compose.runtime.snapshots.StateRecord-.writable-androidx.compose.runtime.snapshots.StateObject-androidx.compose.runtime.snapshots.Snapshot-kotlin.Function1-"></a><a name="writable"></a> |
| <h3 class="api-name" id="(androidx.compose.runtime.snapshots.StateRecord).writable(androidx.compose.runtime.snapshots.StateObject,androidx.compose.runtime.snapshots.Snapshot,kotlin.Function1)">SnapshotKt.writable</h3> |
| <pre class="api-signature no-pretty-print">public static final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> R <T extends <a href="/reference/androidx/compose/runtime/snapshots/StateRecord.html">StateRecord</a>, R extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> <a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html">SnapshotKt</a>.<a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html#(androidx.compose.runtime.snapshots.StateRecord).writable(androidx.compose.runtime.snapshots.StateObject,androidx.compose.runtime.snapshots.Snapshot,kotlin.Function1)">writable</a>(<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T receiver,<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/runtime/snapshots/StateObject.html">StateObject</a> state,<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/runtime/snapshots/Snapshot.html">Snapshot</a> snapshot,<br> @<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-extension-function-type/index.html">ExtensionFunctionType</a> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function1<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> R> block<br>)</pre> |
| <p>Call <code><a href="/reference/androidx/compose/runtime/snapshots/package-summary.html#(androidx.compose.runtime.snapshots.StateRecord).writable(androidx.compose.runtime.snapshots.StateObject,androidx.compose.runtime.snapshots.Snapshot,kotlin.Function1)">block</a></code> with a writable state record for <code><a href="/reference/androidx/compose/runtime/snapshots/package-summary.html#(androidx.compose.runtime.snapshots.StateRecord).writable(androidx.compose.runtime.snapshots.StateObject,androidx.compose.runtime.snapshots.Snapshot,kotlin.Function1)">snapshot</a></code> of the given record. It is assumed that this is called for the first state record in a state object. If the snapshot is read-only calling this will throw.</p> |
| </div> |
| </div> |
| </body> |
| </html> |