blob: 061f293f65d88fd193a7462392033ffcd1bf8704 [file] [log] [blame]
<html devsite="true">
<head>
<title>androidx.paging.rxjava2</title>
{% setvar book_path %}/reference/kotlin/androidx/_book.yaml{% endsetvar %}
{% include "_shared/_reference-head-tags.html" %}
</head>
<body>
<h1>androidx.paging.rxjava2</h1>
{% setvar page_path %}androidx/paging/rxjava2/package-summary.html{% endsetvar %}
{% setvar can_switch %}1{% endsetvar %}
{% include "reference/_kotlin_switcher2.md" %}
<h2>Classes</h2>
<div class="devsite-table-wrapper">
<table class="responsive">
<tbody>
<tr>
<td><code><a href="/reference/kotlin/androidx/paging/rxjava2/RxPagingSource.html">RxPagingSource</a></code></td>
<td width="100%">
<p>Rx-based compatibility wrapper around <code><a href="/reference/kotlin/androidx/paging/PagingSource.html">PagingSource</a></code>'s suspending APIs.</p>
</td>
</tr>
<tr>
<td><code><a href="/reference/kotlin/androidx/paging/rxjava2/RxRemoteMediator.html">RxRemoteMediator</a></code></td>
<td width="100%">
<p>RxJava2 compatibility wrapper around <code><a href="/reference/kotlin/androidx/paging/RemoteMediator.html">RemoteMediator</a></code>'s suspending APIs.</p>
</td>
</tr>
</tbody>
</table>
</div>
<h2>Extension properties summary</h2>
<div class="devsite-table-wrapper">
<table class="responsive">
<tbody>
<tr>
<td><code>@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-opt-in/index.html">OptIn</a>(markerClass&nbsp;=&nbsp;[ExperimentalCoroutinesApi])&nbsp;<a href="/reference/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;<a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;Value&gt;&gt;</code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/paging/Pager.html">Pager</a>&lt;Key,&nbsp;Value&gt;.<a href="/reference/kotlin/androidx/paging/rxjava2/package-summary.html#flowable(androidx.paging.Pager)">flowable</a></code></div>
<p>A Flowable of <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code>, which mirrors the stream provided by <code><a href="/reference/kotlin/androidx/paging/Pager.html#flow()">Pager.flow</a></code>, but exposes it as a Flowable.</p>
</td>
</tr>
<tr>
<td><code>@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-opt-in/index.html">OptIn</a>(markerClass&nbsp;=&nbsp;[ExperimentalCoroutinesApi])&nbsp;<a href="/reference/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;<a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;Value&gt;&gt;</code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/paging/Pager.html">Pager</a>&lt;Key,&nbsp;Value&gt;.<a href="/reference/kotlin/androidx/paging/rxjava2/package-summary.html#observable(androidx.paging.Pager)">observable</a></code></div>
<p>An Observable of <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code>, which mirrors the stream provided by <code><a href="/reference/kotlin/androidx/paging/Pager.html#flow()">Pager.flow</a></code>, but exposes it as an Observable.</p>
</td>
</tr>
</tbody>
</table>
</div>
<h2>Extension functions summary</h2>
<div class="devsite-table-wrapper">
<table class="responsive">
<tbody>
<tr>
<td><code>@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-opt-in/index.html">OptIn</a>(markerClass&nbsp;=&nbsp;[ExperimentalCoroutinesApi])&nbsp;<a href="/reference/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;<a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;&gt;</code></td>
<td width="100%">
<div><code>&lt;T&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>&gt; <a href="/reference/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;<a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;&gt;.<a href="/reference/kotlin/androidx/paging/rxjava2/package-summary.html#cachedIn(Observable&lt;PagingData&lt;T&gt;&gt;,kotlinx.coroutines.CoroutineScope)">cachedIn</a>(scope:&nbsp;<a href="https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html">CoroutineScope</a>)</code></div>
<p>Operator which caches an Observable of <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> within a <code><a href="https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html">CoroutineScope</a></code>.</p>
</td>
</tr>
<tr>
<td><code>@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-opt-in/index.html">OptIn</a>(markerClass&nbsp;=&nbsp;[ExperimentalCoroutinesApi])&nbsp;<a href="/reference/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;<a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;&gt;</code></td>
<td width="100%">
<div><code>&lt;T&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>&gt; <a href="/reference/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;<a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;&gt;.<a href="/reference/kotlin/androidx/paging/rxjava2/package-summary.html#cachedIn(Flowable&lt;PagingData&lt;T&gt;&gt;,kotlinx.coroutines.CoroutineScope)">cachedIn</a>(scope:&nbsp;<a href="https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html">CoroutineScope</a>)</code></div>
<p>Operator which caches a Flowable of <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> within a <code><a href="https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html">CoroutineScope</a></code>.</p>
</td>
</tr>
<tr>
<td><code>@<a href="/reference/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&nbsp;<a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;</code></td>
<td width="100%">
<div><code>&lt;T&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>&gt; <a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;.<a href="/reference/kotlin/androidx/paging/rxjava2/package-summary.html#filterAsync(androidx.paging.PagingData,kotlin.Function1)">filterAsync</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;predicate:&nbsp;(T)&nbsp;-&gt;&nbsp;<a href="/reference/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a>&gt;<br>)</code></div>
<p>Returns a <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> containing only elements matching the given <code><a href="/reference/kotlin/androidx/paging/rxjava2/package-summary.html#predicate()">predicate</a></code>.</p>
</td>
</tr>
<tr>
<td><code>@<a href="/reference/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&nbsp;<a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;R&gt;</code></td>
<td width="100%">
<div><code>&lt;T&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>,&nbsp;R&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>&gt; <a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;.<a href="/reference/kotlin/androidx/paging/rxjava2/package-summary.html#flatMapAsync(androidx.paging.PagingData,kotlin.Function1)">flatMapAsync</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;transform:&nbsp;(T)&nbsp;-&gt;&nbsp;<a href="/reference/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-iterable/index.html">Iterable</a>&lt;R&gt;&gt;<br>)</code></div>
<p>Returns a <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> of all elements returned from applying the given <code><a href="/reference/kotlin/androidx/paging/rxjava2/package-summary.html#transform()">transform</a></code> to each element, as it is loaded.</p>
</td>
</tr>
<tr>
<td><code>@<a href="/reference/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&nbsp;<a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;R&gt;</code></td>
<td width="100%">
<div><code>&lt;T&nbsp;:&nbsp;R,&nbsp;R&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>&gt; <a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;.<a href="/reference/kotlin/androidx/paging/rxjava2/package-summary.html#insertSeparatorsAsync(androidx.paging.PagingData,kotlin.Function2)">insertSeparatorsAsync</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;generator:&nbsp;(T?,&nbsp;T?)&nbsp;-&gt;&nbsp;<a href="/reference/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;R&gt;<br>)</code></div>
<p>Returns a <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> containing each original element, with an optional separator generated by <code><a href="/reference/kotlin/androidx/paging/rxjava2/package-summary.html#generator()">generator</a></code>, given the elements before and after (or null, in boundary conditions).</p>
</td>
</tr>
<tr>
<td><code>@<a href="/reference/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&nbsp;<a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;R&gt;</code></td>
<td width="100%">
<div><code>&lt;T&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>,&nbsp;R&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>&gt; <a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;.<a href="/reference/kotlin/androidx/paging/rxjava2/package-summary.html#mapAsync(androidx.paging.PagingData,kotlin.Function1)">mapAsync</a>(transform:&nbsp;(T)&nbsp;-&gt;&nbsp;<a href="/reference/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;R&gt;)</code></div>
<p>Returns a <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> containing the result of applying the given <code><a href="/reference/kotlin/androidx/paging/rxjava2/package-summary.html#transform()">transform</a></code> to each element, as it is loaded.</p>
</td>
</tr>
</tbody>
</table>
</div>
<h2>Extension properties</h2>
<div><a name="getFlowable(androidx.paging.Pager)"></a><a name="setFlowable(androidx.paging.Pager)"></a><a name="getFlowable-androidx.paging.Pager-"></a><a name="setFlowable-androidx.paging.Pager-"></a>
<h3 class="api-name" id="flowable(androidx.paging.Pager)">flowable</h3>
<pre class="api-signature no-pretty-print">@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-opt-in/index.html">OptIn</a>(markerClass&nbsp;=&nbsp;[ExperimentalCoroutinesApi])<br>val&nbsp;<a href="/reference/kotlin/androidx/paging/Pager.html">Pager</a>&lt;Key,&nbsp;Value&gt;.<a href="/reference/kotlin/androidx/paging/rxjava2/package-summary.html#flowable(androidx.paging.Pager)">flowable</a>:&nbsp;@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-opt-in/index.html">OptIn</a>(markerClass&nbsp;=&nbsp;[ExperimentalCoroutinesApi])&nbsp;<a href="/reference/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;<a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;Value&gt;&gt;</pre>
<p>A <a href="[Flowable]">Flowable</a> of <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code>, which mirrors the stream provided by <code><a href="/reference/kotlin/androidx/paging/Pager.html#flow()">Pager.flow</a></code>, but exposes it as a <a href="[Flowable]">Flowable</a>.</p>
</div>
<div><a name="getObservable(androidx.paging.Pager)"></a><a name="setObservable(androidx.paging.Pager)"></a><a name="getObservable-androidx.paging.Pager-"></a><a name="setObservable-androidx.paging.Pager-"></a>
<h3 class="api-name" id="observable(androidx.paging.Pager)">observable</h3>
<pre class="api-signature no-pretty-print">@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-opt-in/index.html">OptIn</a>(markerClass&nbsp;=&nbsp;[ExperimentalCoroutinesApi])<br>val&nbsp;<a href="/reference/kotlin/androidx/paging/Pager.html">Pager</a>&lt;Key,&nbsp;Value&gt;.<a href="/reference/kotlin/androidx/paging/rxjava2/package-summary.html#observable(androidx.paging.Pager)">observable</a>:&nbsp;@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-opt-in/index.html">OptIn</a>(markerClass&nbsp;=&nbsp;[ExperimentalCoroutinesApi])&nbsp;<a href="/reference/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;<a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;Value&gt;&gt;</pre>
<p>An <a href="[Observable]">Observable</a> of <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code>, which mirrors the stream provided by <code><a href="/reference/kotlin/androidx/paging/Pager.html#flow()">Pager.flow</a></code>, but exposes it as an <a href="[Observable]">Observable</a>.</p>
</div>
<h2>Extension functions</h2>
<div><a name="cachedIn(Observable&lt;PagingData&lt;T&gt;&gt;, kotlinx.coroutines.CoroutineScope)"></a><a name="cachedIn-Observable&lt;PagingData&lt;T&gt;&gt;-kotlinx.coroutines.CoroutineScope-"></a>
<h3 class="api-name" id="cachedIn(Observable&lt;PagingData&lt;T&gt;&gt;,kotlinx.coroutines.CoroutineScope)">cachedIn</h3>
<pre class="api-signature no-pretty-print">@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-opt-in/index.html">OptIn</a>(markerClass&nbsp;=&nbsp;[ExperimentalCoroutinesApi])<br>fun&nbsp;&lt;T&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>&gt; <a href="/reference/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;<a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;&gt;.<a href="/reference/kotlin/androidx/paging/rxjava2/package-summary.html#cachedIn(Observable&lt;PagingData&lt;T&gt;&gt;,kotlinx.coroutines.CoroutineScope)">cachedIn</a>(scope:&nbsp;<a href="https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html">CoroutineScope</a>):&nbsp;@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-opt-in/index.html">OptIn</a>(markerClass&nbsp;=&nbsp;[ExperimentalCoroutinesApi])&nbsp;<a href="/reference/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;<a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;&gt;</pre>
<p>Operator which caches an <a href="[Observable]">Observable</a> of <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> within a <code><a href="https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html">CoroutineScope</a></code>.</p>
<p><code><a href="/reference/kotlin/androidx/paging/package-summary.html#cachedIn(kotlinx.coroutines.flow.Flow,kotlinx.coroutines.CoroutineScope)">cachedIn</a></code> multicasts pages loaded and transformed by a <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code>, allowing multiple observers on the same instance of <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> to receive the same events, avoiding redundant work, but comes at the cost of buffering those events in memory.</p>
<p>Calling <code><a href="/reference/kotlin/androidx/paging/package-summary.html#cachedIn(kotlinx.coroutines.flow.Flow,kotlinx.coroutines.CoroutineScope)">cachedIn</a></code> is required to allow calling <a href="[androidx.paging.AsyncPagingDataAdapter]">androidx.paging.AsyncPagingDataAdapter</a> on the same instance of <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> emitted by <code><a href="/reference/kotlin/androidx/paging/Pager.html">Pager</a></code> or any of its transformed derivatives, as reloading data from scratch on the same generation of <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> is an unsupported operation.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>scope:&nbsp;<a href="https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html">CoroutineScope</a></code></td>
<td width="100%">
<p>The <code><a href="https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html">CoroutineScope</a></code> where the page cache will be kept alive. Typically this would be a managed scope such as <code>ViewModel.viewModelScope</code>, which automatically cancels after the <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> stream is no longer needed. Otherwise, the provided <code><a href="https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html">CoroutineScope</a></code> must be manually cancelled to avoid memory leaks.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="cachedIn(Flowable&lt;PagingData&lt;T&gt;&gt;, kotlinx.coroutines.CoroutineScope)"></a><a name="cachedIn-Flowable&lt;PagingData&lt;T&gt;&gt;-kotlinx.coroutines.CoroutineScope-"></a>
<h3 class="api-name" id="cachedIn(Flowable&lt;PagingData&lt;T&gt;&gt;,kotlinx.coroutines.CoroutineScope)">cachedIn</h3>
<pre class="api-signature no-pretty-print">@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-opt-in/index.html">OptIn</a>(markerClass&nbsp;=&nbsp;[ExperimentalCoroutinesApi])<br>fun&nbsp;&lt;T&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>&gt; <a href="/reference/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;<a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;&gt;.<a href="/reference/kotlin/androidx/paging/rxjava2/package-summary.html#cachedIn(Flowable&lt;PagingData&lt;T&gt;&gt;,kotlinx.coroutines.CoroutineScope)">cachedIn</a>(scope:&nbsp;<a href="https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html">CoroutineScope</a>):&nbsp;@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-opt-in/index.html">OptIn</a>(markerClass&nbsp;=&nbsp;[ExperimentalCoroutinesApi])&nbsp;<a href="/reference/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;<a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;&gt;</pre>
<p>Operator which caches a <a href="[Flowable]">Flowable</a> of <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> within a <code><a href="https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html">CoroutineScope</a></code>.</p>
<p><code><a href="/reference/kotlin/androidx/paging/package-summary.html#cachedIn(kotlinx.coroutines.flow.Flow,kotlinx.coroutines.CoroutineScope)">cachedIn</a></code> multicasts pages loaded and transformed by a <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code>, allowing multiple observers on the same instance of <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> to receive the same events, avoiding redundant work, but comes at the cost of buffering those events in memory.</p>
<p>Calling <code><a href="/reference/kotlin/androidx/paging/package-summary.html#cachedIn(kotlinx.coroutines.flow.Flow,kotlinx.coroutines.CoroutineScope)">cachedIn</a></code> is required to allow calling <a href="[androidx.paging.AsyncPagingDataAdapter]">androidx.paging.AsyncPagingDataAdapter</a> on the same instance of <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> emitted by <code><a href="/reference/kotlin/androidx/paging/Pager.html">Pager</a></code> or any of its transformed derivatives, as reloading data from scratch on the same generation of <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> is an unsupported operation.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>scope:&nbsp;<a href="https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html">CoroutineScope</a></code></td>
<td width="100%">
<p>The <code><a href="https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html">CoroutineScope</a></code> where the page cache will be kept alive. Typically this would be a managed scope such as <code>ViewModel.viewModelScope</code>, which automatically cancels after the <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> stream is no longer needed. Otherwise, the provided <code><a href="https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html">CoroutineScope</a></code> must be manually cancelled to avoid memory leaks.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="filterAsync(androidx.paging.PagingData, kotlin.Function1)"></a><a name="filterAsync-androidx.paging.PagingData-kotlin.Function1-"></a>
<h3 class="api-name" id="filterAsync(androidx.paging.PagingData,kotlin.Function1)">filterAsync</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a><br>fun&nbsp;&lt;T&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>&gt; <a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;.<a href="/reference/kotlin/androidx/paging/rxjava2/package-summary.html#filterAsync(androidx.paging.PagingData,kotlin.Function1)">filterAsync</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;predicate:&nbsp;(T)&nbsp;-&gt;&nbsp;<a href="/reference/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a>&gt;<br>):&nbsp;@<a href="/reference/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&nbsp;<a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;</pre>
<p>Returns a <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> containing only elements matching the given <code><a href="/reference/kotlin/androidx/paging/rxjava2/package-summary.html#predicate()">predicate</a></code>.</p>
</div>
<div><a name="flatMapAsync(androidx.paging.PagingData, kotlin.Function1)"></a><a name="flatMapAsync-androidx.paging.PagingData-kotlin.Function1-"></a>
<h3 class="api-name" id="flatMapAsync(androidx.paging.PagingData,kotlin.Function1)">flatMapAsync</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a><br>fun&nbsp;&lt;T&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>,&nbsp;R&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>&gt; <a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;.<a href="/reference/kotlin/androidx/paging/rxjava2/package-summary.html#flatMapAsync(androidx.paging.PagingData,kotlin.Function1)">flatMapAsync</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;transform:&nbsp;(T)&nbsp;-&gt;&nbsp;<a href="/reference/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-iterable/index.html">Iterable</a>&lt;R&gt;&gt;<br>):&nbsp;@<a href="/reference/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&nbsp;<a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;R&gt;</pre>
<p>Returns a <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> of all elements returned from applying the given <code><a href="/reference/kotlin/androidx/paging/rxjava2/package-summary.html#transform()">transform</a></code> to each element, as it is loaded.</p>
</div>
<div><a name="insertSeparatorsAsync(androidx.paging.PagingData, kotlin.Function2)"></a><a name="insertSeparatorsAsync-androidx.paging.PagingData-kotlin.Function2-"></a>
<h3 class="api-name" id="insertSeparatorsAsync(androidx.paging.PagingData,kotlin.Function2)">insertSeparatorsAsync</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a><br>fun&nbsp;&lt;T&nbsp;:&nbsp;R,&nbsp;R&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>&gt; <a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;.<a href="/reference/kotlin/androidx/paging/rxjava2/package-summary.html#insertSeparatorsAsync(androidx.paging.PagingData,kotlin.Function2)">insertSeparatorsAsync</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;generator:&nbsp;(T?,&nbsp;T?)&nbsp;-&gt;&nbsp;<a href="/reference/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;R&gt;<br>):&nbsp;@<a href="/reference/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&nbsp;<a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;R&gt;</pre>
<p>Returns a <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> containing each original element, with an optional separator generated by <code><a href="/reference/kotlin/androidx/paging/rxjava2/package-summary.html#generator()">generator</a></code>, given the elements before and after (or null, in boundary conditions).</p>
<p>Note that this transform is applied asynchronously, as pages are loaded. Potential separators between pages are only computed once both pages are loaded.</p>
</div>
<div><a name="mapAsync(androidx.paging.PagingData, kotlin.Function1)"></a><a name="mapAsync-androidx.paging.PagingData-kotlin.Function1-"></a>
<h3 class="api-name" id="mapAsync(androidx.paging.PagingData,kotlin.Function1)">mapAsync</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a><br>fun&nbsp;&lt;T&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>,&nbsp;R&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>&gt; <a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;.<a href="/reference/kotlin/androidx/paging/rxjava2/package-summary.html#mapAsync(androidx.paging.PagingData,kotlin.Function1)">mapAsync</a>(transform:&nbsp;(T)&nbsp;-&gt;&nbsp;<a href="/reference/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;R&gt;):&nbsp;@<a href="/reference/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&nbsp;<a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;R&gt;</pre>
<p>Returns a <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> containing the result of applying the given <code><a href="/reference/kotlin/androidx/paging/rxjava2/package-summary.html#transform()">transform</a></code> to each element, as it is loaded.</p>
</div>
</body>
</html>