# PagingSource.LoadParams

Artifact: [androidx.paging:paging-common](https://developer.android.com/jetpack/androidx/releases/paging) [View Source](https://cs.android.com/search?q=file:androidx/paging/PagingSource.kt+class:androidx.paging.PagingSource.LoadParams) Added in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0)

*** ** * ** ***


```
public sealed class PagingSource.LoadParams<Key extends Object>
```

<br />

Known direct subclasses [PagingSource.LoadParams.Append](https://developer.android.com/reference/androidx/paging/PagingSource.LoadParams.Append), [PagingSource.LoadParams.Prepend](https://developer.android.com/reference/androidx/paging/PagingSource.LoadParams.Prepend), [PagingSource.LoadParams.Refresh](https://developer.android.com/reference/androidx/paging/PagingSource.LoadParams.Refresh)

|---|---|
| `https://developer.android.com/reference/androidx/paging/PagingSource.LoadParams.Append` | Params to load a page of data from a `https://developer.android.com/reference/androidx/paging/PagingSource` via `https://developer.android.com/reference/androidx/paging/PagingSource#load(androidx.paging.PagingSource.LoadParams)` to be appended to the end of the list. |
| `https://developer.android.com/reference/androidx/paging/PagingSource.LoadParams.Prepend` | Params to load a page of data from a `https://developer.android.com/reference/androidx/paging/PagingSource` via `https://developer.android.com/reference/androidx/paging/PagingSource#load(androidx.paging.PagingSource.LoadParams)` to be prepended to the start of the list. |
| `https://developer.android.com/reference/androidx/paging/PagingSource.LoadParams.Refresh` | Params for an initial load request on a `https://developer.android.com/reference/androidx/paging/PagingSource` from `https://developer.android.com/reference/androidx/paging/PagingSource#load(androidx.paging.PagingSource.LoadParams)` or a refresh triggered by `https://developer.android.com/reference/androidx/paging/PagingSource#invalidate()`. |

*** ** * ** ***

Params for a load request on a `https://developer.android.com/reference/androidx/paging/PagingSource` from `https://developer.android.com/reference/androidx/paging/PagingSource#load(androidx.paging.PagingSource.LoadParams)`.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/paging/PagingSource.LoadParams.Append<Key extends https://developer.android.com/reference/java/lang/Object.html> extends https://developer.android.com/reference/androidx/paging/PagingSource.LoadParams<@https://developer.android.com/reference/androidx/annotation/NonNull Key>` Params to load a page of data from a `https://developer.android.com/reference/androidx/paging/PagingSource` via `https://developer.android.com/reference/androidx/paging/PagingSource#load(androidx.paging.PagingSource.LoadParams)` to be appended to the end of the list. |
| `public final class https://developer.android.com/reference/androidx/paging/PagingSource.LoadParams.Prepend<Key extends https://developer.android.com/reference/java/lang/Object.html> extends https://developer.android.com/reference/androidx/paging/PagingSource.LoadParams<@https://developer.android.com/reference/androidx/annotation/NonNull Key>` Params to load a page of data from a `https://developer.android.com/reference/androidx/paging/PagingSource` via `https://developer.android.com/reference/androidx/paging/PagingSource#load(androidx.paging.PagingSource.LoadParams)` to be prepended to the start of the list. |
| `public final class https://developer.android.com/reference/androidx/paging/PagingSource.LoadParams.Refresh<Key extends https://developer.android.com/reference/java/lang/Object.html> extends https://developer.android.com/reference/androidx/paging/PagingSource.LoadParams<@https://developer.android.com/reference/androidx/annotation/NonNull Key>` Params for an initial load request on a `https://developer.android.com/reference/androidx/paging/PagingSource` from `https://developer.android.com/reference/androidx/paging/PagingSource#load(androidx.paging.PagingSource.LoadParams)` or a refresh triggered by `https://developer.android.com/reference/androidx/paging/PagingSource#invalidate()`. |

| ### Protected constructors |
|---|
| `<Key extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/paging/PagingSource.LoadParams#LoadParams(kotlin.Int,kotlin.Boolean)(int loadSize, boolean placeholdersEnabled)` |

| ### Public methods |
|---|---|
| `abstract Key` | `https://developer.android.com/reference/androidx/paging/PagingSource.LoadParams#getKey()()` Key for the page to be loaded. |
| `final int` | `https://developer.android.com/reference/androidx/paging/PagingSource.LoadParams#getLoadSize()()` Requested number of items to load. |
| `final boolean` | `https://developer.android.com/reference/androidx/paging/PagingSource.LoadParams#getPlaceholdersEnabled()()` From `https://developer.android.com/reference/androidx/paging/PagingConfig#enablePlaceholders()`, true if placeholders are enabled and the load request for this `https://developer.android.com/reference/androidx/paging/PagingSource.LoadParams` should populate `https://developer.android.com/reference/androidx/paging/PagingSource.LoadResult.Page#itemsBefore()` and `https://developer.android.com/reference/androidx/paging/PagingSource.LoadResult.Page#itemsAfter()` if possible. |

## Protected constructors

### LoadParams

```
protected <Key extends Object> LoadParams(int loadSize, boolean placeholdersEnabled)
```

## Public methods

### getKey

Added in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0)

```
public abstract Key getKey()
```

Key for the page to be loaded.

`https://developer.android.com/reference/androidx/paging/PagingSource.LoadParams#key()` can be `null` only if this `https://developer.android.com/reference/androidx/paging/PagingSource.LoadParams` is `https://developer.android.com/reference/androidx/paging/PagingSource.LoadParams.Refresh`, and either no `initialKey` is provided to the `https://developer.android.com/reference/androidx/paging/Pager` or `https://developer.android.com/reference/androidx/paging/PagingSource#getRefreshKey(androidx.paging.PagingState)` from the previous `https://developer.android.com/reference/androidx/paging/PagingSource` returns `null`.

The value of `https://developer.android.com/reference/androidx/paging/PagingSource.LoadParams#key()` is dependent on the type of `https://developer.android.com/reference/androidx/paging/PagingSource.LoadParams`:

- `https://developer.android.com/reference/androidx/paging/PagingSource.LoadParams.Refresh`

  - On initial load, the nullable `initialKey` passed to the `https://developer.android.com/reference/androidx/paging/Pager`.

  - On subsequent loads due to invalidation or refresh, the result of `https://developer.android.com/reference/androidx/paging/PagingSource#getRefreshKey(androidx.paging.PagingState)`.

- `https://developer.android.com/reference/androidx/paging/PagingSource.LoadParams.Prepend` - `https://developer.android.com/reference/androidx/paging/PagingSource.LoadResult.Page#prevKey()` of the loaded page at the front of the list.

- `https://developer.android.com/reference/androidx/paging/PagingSource.LoadParams.Append` - `https://developer.android.com/reference/androidx/paging/PagingSource.LoadResult.Page#nextKey()` of the loaded page at the end of the list.

### getLoadSize

Added in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0)

```
public final int getLoadSize()
```

Requested number of items to load.

Note: It is valid for `https://developer.android.com/reference/androidx/paging/PagingSource#load(androidx.paging.PagingSource.LoadParams)` to return a `https://developer.android.com/reference/androidx/paging/PagingSource.LoadResult` that has a different number of items than the requested load size.

### getPlaceholdersEnabled

Added in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0)

```
public final boolean getPlaceholdersEnabled()
```

From `https://developer.android.com/reference/androidx/paging/PagingConfig#enablePlaceholders()`, true if placeholders are enabled and the load request for this `https://developer.android.com/reference/androidx/paging/PagingSource.LoadParams` should populate `https://developer.android.com/reference/androidx/paging/PagingSource.LoadResult.Page#itemsBefore()` and `https://developer.android.com/reference/androidx/paging/PagingSource.LoadResult.Page#itemsAfter()` if possible.