# WriteScope

Artifact: [androidx.datastore:datastore-core](https://developer.android.com/jetpack/androidx/releases/datastore) [View Source](https://cs.android.com/search?q=file:androidx/datastore/core/StorageConnection.kt+class:androidx.datastore.core.WriteScope) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/datastore#1.1.0)

*** ** * ** ***

Common/AllAndroid/JVMNative/C/iOSJavaScript
- Cmn

  ```
  interface WriteScope<T : Any?> : ReadScope<T>
  ```

*** ** * ** ***

The scope used for a write transaction.

## Summary

| ### Public functions |
|---|---|---|
| `suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/datastore/core/WriteScope#writeData(kotlin.Any)(value: T)` Writes the data to the underlying storage. | Cmn |

### Inherited functions

From [androidx.datastore.core.Closeable](https://developer.android.com/reference/kotlin/androidx/datastore/core/Closeable) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/datastore/core/Closeable#close()()`

Closes the specified resource.
Cmn From [androidx.datastore.core.ReadScope](https://developer.android.com/reference/kotlin/androidx/datastore/core/ReadScope) `suspend T` `https://developer.android.com/reference/kotlin/androidx/datastore/core/ReadScope#readData()()`

Read the data from the underlying storage.
Cmn

## Public functions

### writeData

Cmn Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/datastore#1.1.0)

```
suspend fun writeData(value: T): Unit
```

Writes the data to the underlying storage.