---
title: "createFromBoolean"
description: "Creates a [FillableData] instance from a [Boolean].

This function is used to wrap a boolean value for autofill purposes, such as the state of a
checkbox or a switch."
type: "function"
---

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


<a id='references'></a>
<div class='sourceset sourceset-common'>Common</div>


```kotlin
expect fun FillableData.Companion.createFromBoolean(booleanValue: Boolean): FillableData?
```


Creates a `FillableData` instance from a `Boolean`.

This function is used to wrap a boolean value for autofill purposes, such as the state of a
checkbox or a switch.

#### Parameters

| | |
| --- | --- |
| booleanValue | The boolean data to be used for autofill. |


#### Returns

| | |
| --- | --- |
|  | A `FillableData` object containing the boolean data, or `null` if the platform does not support autofill. |




<div class='sourceset sourceset-android'>Android</div>


```kotlin
actual fun FillableData.Companion.createFromBoolean(booleanValue: Boolean): FillableData?
```


Creates a `FillableData` instance from a `Boolean`.

This function is used to wrap a boolean value for autofill purposes, such as the state of a
checkbox or a switch. On Android, it creates an `AutofillValue` that represents a toggle state.

#### Parameters

| | |
| --- | --- |
| booleanValue | The boolean data to be used for autofill. |


#### Returns

| | |
| --- | --- |
|  | A `FillableData` object containing the boolean data, or `null` if the platform version is lower than `Build.VERSION_CODES.O`. |




