# QrCode

Artifact: [androidx.xr.arcore:arcore](https://developer.android.com/jetpack/androidx/releases/xr-arcore) [View Source](https://cs.android.com/search?q=file:androidx/xr/arcore/QrCode.kt+class:androidx.xr.arcore.QrCode) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-arcore#1.0.0)

*** ** * ** ***


```
class QrCode : Trackable<QrCode.State>
```

<br />

*** ** * ** ***

Describes the current best knowledge of a real-world QR code

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/xr/arcore/QrCode.State : https://developer.android.com/reference/kotlin/androidx/xr/arcore/Trackable.State` The representation of the current state of a `https://developer.android.com/reference/kotlin/androidx/xr/arcore/QrCode`. |

| ### Public companion functions |
|---|---|
| `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-state-flow/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-collection/index.html<https://developer.android.com/reference/kotlin/androidx/xr/arcore/QrCode>>` | `https://developer.android.com/reference/kotlin/androidx/xr/arcore/QrCode#subscribe(androidx.xr.runtime.Session)(session: https://developer.android.com/reference/kotlin/androidx/xr/runtime/Session)` Emits the QR codes that are currently being tracked in the `https://developer.android.com/reference/kotlin/androidx/xr/arcore/QrCode.Companion#subscribe(androidx.xr.runtime.Session)`. |

| ### Public functions |
|---|---|
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/arcore/QrCode#toString()()` Returns a string representation of `https://developer.android.com/reference/kotlin/androidx/xr/arcore/QrCode` for debugging. |

| ### Public properties |
|---|---|
| `open https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-state-flow/index.html<https://developer.android.com/reference/kotlin/androidx/xr/arcore/QrCode.State>` | `https://developer.android.com/reference/kotlin/androidx/xr/arcore/QrCode#state()` The current state of the `https://developer.android.com/reference/kotlin/androidx/xr/arcore/QrCode` |

## Public companion functions

### subscribe

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-arcore#1.0.0)

```
fun subscribe(session: Session): StateFlow<Collection<QrCode>>
```

Emits the QR codes that are currently being tracked in the `https://developer.android.com/reference/kotlin/androidx/xr/arcore/QrCode.Companion#subscribe(androidx.xr.runtime.Session)`.

Only instances of `https://developer.android.com/reference/kotlin/androidx/xr/arcore/QrCode` that are `https://developer.android.com/reference/kotlin/androidx/xr/arcore/TrackingState#TRACKING()` will be emitted in the `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-collection/index.html`. Instances of the same `https://developer.android.com/reference/kotlin/androidx/xr/arcore/QrCode` will remain between subsequent emits to the `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-state-flow/index.html` as long as they remain tracking.

| Parameters |
|---|---|
| `session: https://developer.android.com/reference/kotlin/androidx/xr/runtime/Session` | the `https://developer.android.com/reference/kotlin/androidx/xr/runtime/Session` to subscribe to |

| Returns |
|---|---|
| `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-state-flow/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-collection/index.html<https://developer.android.com/reference/kotlin/androidx/xr/arcore/QrCode>>` | a `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-state-flow/index.html` that emits a collection of QrCodes |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` | if `https://developer.android.com/reference/kotlin/androidx/xr/runtime/Config#qrCodeTracking()` is set to `https://developer.android.com/reference/kotlin/androidx/xr/runtime/QrCodeTrackingMode#DISABLED()` |

## Public functions

### toString

```
open fun toString(): String
```

Returns a string representation of `https://developer.android.com/reference/kotlin/androidx/xr/arcore/QrCode` for debugging.

Note: Not intended for production use.

## Public properties

### state

```
open val state: StateFlow<QrCode.State>
```

The current state of the `https://developer.android.com/reference/kotlin/androidx/xr/arcore/QrCode`