# LivePagedListKt

Added in 2.1.0

*** ** * ** ***


```
public final class LivePagedListKt
```

<br />

*** ** * ** ***

## Summary

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/LiveData<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PagedList<@https://developer.android.com/reference/androidx/annotation/NonNull Value>>` | `<Key extends https://developer.android.com/reference/java/lang/Object.html, Value extends https://developer.android.com/reference/java/lang/Object.html> [toLiveData](https://developer.android.com/reference/androidx/paging/LivePagedListKt#(androidx.paging.DataSource.Factory).toLiveData(androidx.paging.PagedList.Config,kotlin.Any,androidx.paging.PagedList.BoundaryCallback,java.util.concurrent.Executor))( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/DataSource.Factory<@https://developer.android.com/reference/androidx/annotation/NonNull Key, @https://developer.android.com/reference/androidx/annotation/NonNull Value> receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PagedList.Config config, Key initialLoadKey, https://developer.android.com/reference/androidx/paging/PagedList.BoundaryCallback<@https://developer.android.com/reference/androidx/annotation/NonNull Value> boundaryCallback, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/concurrent/Executor.html fetchExecutor )` **This method is deprecated.** PagedList is deprecated and has been replaced by PagingData |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/LiveData<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PagedList<@https://developer.android.com/reference/androidx/annotation/NonNull Value>>` | `<Key extends https://developer.android.com/reference/java/lang/Object.html, Value extends https://developer.android.com/reference/java/lang/Object.html> [toLiveData](https://developer.android.com/reference/androidx/paging/LivePagedListKt#(androidx.paging.DataSource.Factory).toLiveData(kotlin.Int,kotlin.Any,androidx.paging.PagedList.BoundaryCallback,java.util.concurrent.Executor))( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/DataSource.Factory<@https://developer.android.com/reference/androidx/annotation/NonNull Key, @https://developer.android.com/reference/androidx/annotation/NonNull Value> receiver, int pageSize, Key initialLoadKey, https://developer.android.com/reference/androidx/paging/PagedList.BoundaryCallback<@https://developer.android.com/reference/androidx/annotation/NonNull Value> boundaryCallback, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/concurrent/Executor.html fetchExecutor )` **This method is deprecated.** PagedList is deprecated and has been replaced by PagingData |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/LiveData<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PagedList<@https://developer.android.com/reference/androidx/annotation/NonNull Value>>` | `<Key extends https://developer.android.com/reference/java/lang/Object.html, Value extends https://developer.android.com/reference/java/lang/Object.html> [toLiveData](https://developer.android.com/reference/androidx/paging/LivePagedListKt#(kotlin.Function0).toLiveData(androidx.paging.PagedList.Config,kotlin.Any,androidx.paging.PagedList.BoundaryCallback,kotlinx.coroutines.CoroutineScope,kotlinx.coroutines.CoroutineDispatcher))( @https://developer.android.com/reference/androidx/annotation/NonNull Function0<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PagingSource<@https://developer.android.com/reference/androidx/annotation/NonNull Key, @https://developer.android.com/reference/androidx/annotation/NonNull Value>> receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PagedList.Config config, Key initialLoadKey, https://developer.android.com/reference/androidx/paging/PagedList.BoundaryCallback<@https://developer.android.com/reference/androidx/annotation/NonNull Value> boundaryCallback, @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html coroutineScope, @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html fetchDispatcher )` **This method is deprecated.** PagedList is deprecated and has been replaced by PagingData |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/LiveData<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PagedList<@https://developer.android.com/reference/androidx/annotation/NonNull Value>>` | `<Key extends https://developer.android.com/reference/java/lang/Object.html, Value extends https://developer.android.com/reference/java/lang/Object.html> [toLiveData](https://developer.android.com/reference/androidx/paging/LivePagedListKt#(kotlin.Function0).toLiveData(kotlin.Int,kotlin.Any,androidx.paging.PagedList.BoundaryCallback,kotlinx.coroutines.CoroutineScope,kotlinx.coroutines.CoroutineDispatcher))( @https://developer.android.com/reference/androidx/annotation/NonNull Function0<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PagingSource<@https://developer.android.com/reference/androidx/annotation/NonNull Key, @https://developer.android.com/reference/androidx/annotation/NonNull Value>> receiver, int pageSize, Key initialLoadKey, https://developer.android.com/reference/androidx/paging/PagedList.BoundaryCallback<@https://developer.android.com/reference/androidx/annotation/NonNull Value> boundaryCallback, @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html coroutineScope, @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html fetchDispatcher )` **This method is deprecated.** PagedList is deprecated and has been replaced by PagingData |

## Public methods

### toLiveData

Artifact: [androidx.paging:paging-runtime](https://developer.android.com/jetpack/androidx/releases/paging) [View Source](https://cs.android.com/search?q=file:androidx/paging/LivePagedList.kt+function:toLiveData) Added in [2.1.0](https://developer.android.com/jetpack/androidx/releases/paging#2.1.0)

```
public static final @NonNull LiveData<@NonNull PagedList<@NonNull Value>> <Key extends Object, Value extends Object> [toLiveData](https://developer.android.com/reference/androidx/paging/LivePagedListKt#(androidx.paging.DataSource.Factory).toLiveData(androidx.paging.PagedList.Config,kotlin.Any,androidx.paging.PagedList.BoundaryCallback,java.util.concurrent.Executor))(
    @NonNull DataSource.Factory<@NonNull Key, @NonNull Value> receiver,
    @NonNull PagedList.Config config,
    Key initialLoadKey,
    PagedList.BoundaryCallback<@NonNull Value> boundaryCallback,
    @NonNull Executor fetchExecutor
)
```

> [!CAUTION]
> **This method is deprecated.**   
> PagedList is deprecated and has been replaced by PagingData, use this instead:
>
> ```
> Pager(
>             PagingConfig(
>                 config.pageSize,
>                 config.prefetchDistance,
>                 config.enablePlaceholders,
>                 config.initialLoadSizeHint,
>                 config.maxSize
>             ),
>             initialLoadKey,
>             this.asPagingSourceFactory(fetchExecutor.asCoroutineDispatcher())
>         ).liveData
> ```

Constructs a `LiveData<PagedList>`, from this `https://developer.android.com/reference/androidx/paging/DataSource.Factory`, convenience for `https://developer.android.com/reference/androidx/paging/LivePagedListBuilder`.

No work (such as loading) is done immediately, the creation of the first `https://developer.android.com/reference/androidx/paging/PagedList` is deferred until the `https://developer.android.com/reference/androidx/lifecycle/LiveData` is observed.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PagedList.Config config` | Paging configuration. |
| `Key initialLoadKey` | Initial load key passed to the first `https://developer.android.com/reference/androidx/paging/PagedList` / `https://developer.android.com/reference/androidx/paging/PagingSource`. |
| `https://developer.android.com/reference/androidx/paging/PagedList.BoundaryCallback<@https://developer.android.com/reference/androidx/annotation/NonNull Value> boundaryCallback` | The boundary callback for listening to `https://developer.android.com/reference/androidx/paging/PagedList` load state. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/concurrent/Executor.html fetchExecutor` | `https://developer.android.com/reference/java/util/concurrent/Executor.html` for fetching data from `https://developer.android.com/reference/androidx/paging/PagingSource`s. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/paging/LivePagedListBuilder` |   |

### toLiveData

Artifact: [androidx.paging:paging-runtime](https://developer.android.com/jetpack/androidx/releases/paging) [View Source](https://cs.android.com/search?q=file:androidx/paging/LivePagedList.kt+function:toLiveData) Added in [2.1.0](https://developer.android.com/jetpack/androidx/releases/paging#2.1.0)

```
public static final @NonNull LiveData<@NonNull PagedList<@NonNull Value>> <Key extends Object, Value extends Object> [toLiveData](https://developer.android.com/reference/androidx/paging/LivePagedListKt#(androidx.paging.DataSource.Factory).toLiveData(kotlin.Int,kotlin.Any,androidx.paging.PagedList.BoundaryCallback,java.util.concurrent.Executor))(
    @NonNull DataSource.Factory<@NonNull Key, @NonNull Value> receiver,
    int pageSize,
    Key initialLoadKey,
    PagedList.BoundaryCallback<@NonNull Value> boundaryCallback,
    @NonNull Executor fetchExecutor
)
```

> [!CAUTION]
> **This method is deprecated.**   
> PagedList is deprecated and has been replaced by PagingData, use this instead:
>
> ```
> Pager(
>             PagingConfig(pageSize),
>             initialLoadKey,
>             this.asPagingSourceFactory(fetchExecutor.asCoroutineDispatcher())
>         ).liveData
> ```

Constructs a `LiveData<PagedList>`, from this `DataSource.Factory`, convenience for `https://developer.android.com/reference/androidx/paging/LivePagedListBuilder`.

No work (such as loading) is done immediately, the creation of the first `https://developer.android.com/reference/androidx/paging/PagedList` is deferred until the `https://developer.android.com/reference/androidx/lifecycle/LiveData` is observed.

| Parameters |
|---|---|
| `int pageSize` | Page size. |
| `Key initialLoadKey` | Initial load key passed to the first `https://developer.android.com/reference/androidx/paging/PagedList` / `https://developer.android.com/reference/androidx/paging/PagingSource`. |
| `https://developer.android.com/reference/androidx/paging/PagedList.BoundaryCallback<@https://developer.android.com/reference/androidx/annotation/NonNull Value> boundaryCallback` | The boundary callback for listening to `https://developer.android.com/reference/androidx/paging/PagedList` load state. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/concurrent/Executor.html fetchExecutor` | Executor for fetching data from DataSources. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/paging/LivePagedListBuilder` |   |

### toLiveData

Artifact: [androidx.paging:paging-runtime](https://developer.android.com/jetpack/androidx/releases/paging) [View Source](https://cs.android.com/search?q=file:androidx/paging/LivePagedList.kt+function:toLiveData)

```
public static final @NonNull LiveData<@NonNull PagedList<@NonNull Value>> <Key extends Object, Value extends Object> [toLiveData](https://developer.android.com/reference/androidx/paging/LivePagedListKt#(kotlin.Function0).toLiveData(androidx.paging.PagedList.Config,kotlin.Any,androidx.paging.PagedList.BoundaryCallback,kotlinx.coroutines.CoroutineScope,kotlinx.coroutines.CoroutineDispatcher))(
    @NonNull Function0<@NonNull PagingSource<@NonNull Key, @NonNull Value>> receiver,
    @NonNull PagedList.Config config,
    Key initialLoadKey,
    PagedList.BoundaryCallback<@NonNull Value> boundaryCallback,
    @NonNull CoroutineScope coroutineScope,
    @NonNull CoroutineDispatcher fetchDispatcher
)
```

> [!CAUTION]
> **This method is deprecated.**   
> PagedList is deprecated and has been replaced by PagingData, use this instead:
>
> ```
> Pager(
>             PagingConfig(
>                 config.pageSize,
>                 config.prefetchDistance,
>                 config.enablePlaceholders,
>                 config.initialLoadSizeHint,
>                 config.maxSize
>             ),
>             initialLoadKey,
>             this
>         ).liveData
> ```

Constructs a `LiveData<PagedList>`, from this PagingSource factory, convenience for `https://developer.android.com/reference/androidx/paging/LivePagedListBuilder`.

No work (such as loading) is done immediately, the creation of the first `https://developer.android.com/reference/androidx/paging/PagedList` is deferred until the `https://developer.android.com/reference/androidx/lifecycle/LiveData` is observed.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PagedList.Config config` | Paging configuration. |
| `Key initialLoadKey` | Initial load key passed to the first `https://developer.android.com/reference/androidx/paging/PagedList` / `https://developer.android.com/reference/androidx/paging/PagingSource`. |
| `https://developer.android.com/reference/androidx/paging/PagedList.BoundaryCallback<@https://developer.android.com/reference/androidx/annotation/NonNull Value> boundaryCallback` | The boundary callback for listening to `https://developer.android.com/reference/androidx/paging/PagedList` load state. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html coroutineScope` | Set the `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html` that page loads should be launched within. The set `https://developer.android.com/reference/androidx/paging/package-summary#(kotlin.Function0).toLiveData(androidx.paging.PagedList.Config,kotlin.Any,androidx.paging.PagedList.BoundaryCallback,kotlinx.coroutines.CoroutineScope,kotlinx.coroutines.CoroutineDispatcher)` allows a `https://developer.android.com/reference/androidx/paging/PagingSource` to cancel running load operations when the results are no longer needed - for example, when the containing activity is destroyed. Defaults to `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-global-scope/index.html`. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html fetchDispatcher` | `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html` for fetching data from `https://developer.android.com/reference/androidx/paging/PagingSource`s. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/paging/LivePagedListBuilder` |   |

### toLiveData

Artifact: [androidx.paging:paging-runtime](https://developer.android.com/jetpack/androidx/releases/paging) [View Source](https://cs.android.com/search?q=file:androidx/paging/LivePagedList.kt+function:toLiveData)

```
public static final @NonNull LiveData<@NonNull PagedList<@NonNull Value>> <Key extends Object, Value extends Object> [toLiveData](https://developer.android.com/reference/androidx/paging/LivePagedListKt#(kotlin.Function0).toLiveData(kotlin.Int,kotlin.Any,androidx.paging.PagedList.BoundaryCallback,kotlinx.coroutines.CoroutineScope,kotlinx.coroutines.CoroutineDispatcher))(
    @NonNull Function0<@NonNull PagingSource<@NonNull Key, @NonNull Value>> receiver,
    int pageSize,
    Key initialLoadKey,
    PagedList.BoundaryCallback<@NonNull Value> boundaryCallback,
    @NonNull CoroutineScope coroutineScope,
    @NonNull CoroutineDispatcher fetchDispatcher
)
```

> [!CAUTION]
> **This method is deprecated.**   
> PagedList is deprecated and has been replaced by PagingData, use this instead:
>
> ```
> Pager(
>             PagingConfig(pageSize),
>             initialLoadKey,
>             this
>         ).liveData
> ```

Constructs a `LiveData<PagedList>`, from this PagingSource factory, convenience for `https://developer.android.com/reference/androidx/paging/LivePagedListBuilder`.

No work (such as loading) is done immediately, the creation of the first `https://developer.android.com/reference/androidx/paging/PagedList` is deferred until the `https://developer.android.com/reference/androidx/lifecycle/LiveData` is observed.

| Parameters |
|---|---|
| `int pageSize` | Page size. |
| `Key initialLoadKey` | Initial load key passed to the first `https://developer.android.com/reference/androidx/paging/PagedList` / `https://developer.android.com/reference/androidx/paging/PagingSource`. |
| `https://developer.android.com/reference/androidx/paging/PagedList.BoundaryCallback<@https://developer.android.com/reference/androidx/annotation/NonNull Value> boundaryCallback` | The boundary callback for listening to `https://developer.android.com/reference/androidx/paging/PagedList` load state. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html coroutineScope` | Set the `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html` that page loads should be launched within. The set `https://developer.android.com/reference/androidx/paging/package-summary#(kotlin.Function0).toLiveData(kotlin.Int,kotlin.Any,androidx.paging.PagedList.BoundaryCallback,kotlinx.coroutines.CoroutineScope,kotlinx.coroutines.CoroutineDispatcher)` allows a `https://developer.android.com/reference/androidx/paging/PagingSource` to cancel running load operations when the results are no longer needed - for example, when the containing activity is destroyed. Defaults to `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-global-scope/index.html`. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html fetchDispatcher` | `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html` for fetching data from `https://developer.android.com/reference/androidx/paging/PagingSource`s. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/paging/LivePagedListBuilder` |   |