blob: 0cda5149fd9590719180d2ad96afaf12ef8e22d8 [file] [log] [blame]
<html devsite="true">
<head>
<title>PagingRxKt</title>
{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %}
{% include "_shared/_reference-head-tags.html" %}
</head>
<body>
<h1>PagingRxKt</h1>
{% setvar page_path %}androidx/paging/rxjava2/PagingRxKt.html{% endsetvar %}
{% setvar can_switch %}1{% endsetvar %}
{% include "reference/_java_switcher2.md" %}
<p>
<pre>public final class PagingRxKt</pre>
</p>
<hr>
<h2>Summary</h2>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2"><h3>Public fields</h3></th>
</tr>
</thead>
<tbody>
<tr>
<td><code>final <a href="/reference/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;<a href="/reference/androidx/paging/PagingData.html">PagingData</a>&lt;Value&gt;&gt;</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/rxjava2/package-summary.html#flowable(androidx.paging.Pager)">flowable</a></code></div>
<p>A Flowable of <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code>, which mirrors the stream provided by <code><a href="/reference/androidx/paging/Pager.html#flow()">Pager.flow</a></code>, but exposes it as a Flowable.</p>
</td>
</tr>
<tr>
<td><code>final <a href="/reference/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;<a href="/reference/androidx/paging/PagingData.html">PagingData</a>&lt;Value&gt;&gt;</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/rxjava2/package-summary.html#observable(androidx.paging.Pager)">observable</a></code></div>
<p>An Observable of <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code>, which mirrors the stream provided by <code><a href="/reference/androidx/paging/Pager.html#flow()">Pager.flow</a></code>, but exposes it as an Observable.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2"><h3>Public methods</h3></th>
</tr>
</thead>
<tbody>
<tr>
<td><code>static&nbsp;final <a href="/reference/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;<a href="/reference/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;&gt;</code></td>
<td width="100%">
<div><code>&lt;T&nbsp;extends&nbsp;<a href="/reference/java/lang/Object.html">Object</a>&gt; <a href="/reference/androidx/paging/rxjava2/PagingRxKt.html#cachedIn(,kotlinx.coroutines.CoroutineScope)">cachedIn</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="/reference/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;<a href="/reference/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;&gt;&nbsp;receiver,<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="/reference/kotlinx/coroutines/CoroutineScope.html">CoroutineScope</a>&nbsp;scope<br>)</code></div>
<p>Operator which caches an Observable of <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code> within a <code><a href="/reference/kotlinx/coroutines/CoroutineScope.html">CoroutineScope</a></code>.</p>
</td>
</tr>
<tr>
<td><code>static&nbsp;final <a href="/reference/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;<a href="/reference/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;&gt;</code></td>
<td width="100%">
<div><code>&lt;T&nbsp;extends&nbsp;<a href="/reference/java/lang/Object.html">Object</a>&gt; <a href="/reference/androidx/paging/rxjava2/PagingRxKt.html#cachedIn(,kotlinx.coroutines.CoroutineScope)">cachedIn</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="/reference/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;<a href="/reference/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;&gt;&nbsp;receiver,<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="/reference/kotlinx/coroutines/CoroutineScope.html">CoroutineScope</a>&nbsp;scope<br>)</code></div>
<p>Operator which caches a Flowable of <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code> within a <code><a href="/reference/kotlinx/coroutines/CoroutineScope.html">CoroutineScope</a></code>.</p>
</td>
</tr>
</tbody>
</table>
</div>
<h2>Public fields</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="/reference/kotlin/OptIn.html">OptIn</a>(markerClass&nbsp;=&nbsp;[ExperimentalCoroutinesApi])<br>public&nbsp;final&nbsp;<a href="/reference/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;<a href="/reference/androidx/paging/PagingData.html">PagingData</a>&lt;Value&gt;&gt;&nbsp;<a href="/reference/androidx/paging/rxjava2/package-summary.html#flowable(androidx.paging.Pager)">flowable</a></pre>
<p>A <a href="[Flowable]">Flowable</a> of <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code>, which mirrors the stream provided by <code><a href="/reference/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="/reference/kotlin/OptIn.html">OptIn</a>(markerClass&nbsp;=&nbsp;[ExperimentalCoroutinesApi])<br>public&nbsp;final&nbsp;<a href="/reference/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;<a href="/reference/androidx/paging/PagingData.html">PagingData</a>&lt;Value&gt;&gt;&nbsp;<a href="/reference/androidx/paging/rxjava2/package-summary.html#observable(androidx.paging.Pager)">observable</a></pre>
<p>An <a href="[Observable]">Observable</a> of <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code>, which mirrors the stream provided by <code><a href="/reference/androidx/paging/Pager.html#flow()">Pager.flow</a></code>, but exposes it as an <a href="[Observable]">Observable</a>.</p>
</div>
<h2>Public methods</h2>
<div><a name="cachedIn(, kotlinx.coroutines.CoroutineScope)"></a><a name="cachedIn--kotlinx.coroutines.CoroutineScope-"></a>
<h3 class="api-name" id="cachedIn(,kotlinx.coroutines.CoroutineScope)">cachedIn</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/kotlin/OptIn.html">OptIn</a>(markerClass&nbsp;=&nbsp;[ExperimentalCoroutinesApi])<br>public&nbsp;static&nbsp;final&nbsp;<a href="/reference/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;<a href="/reference/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;&gt;&nbsp;&lt;T&nbsp;extends&nbsp;<a href="/reference/java/lang/Object.html">Object</a>&gt; <a href="/reference/androidx/paging/rxjava2/PagingRxKt.html#cachedIn(,kotlinx.coroutines.CoroutineScope)">cachedIn</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="/reference/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;<a href="/reference/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;&gt;&nbsp;receiver,<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="/reference/kotlinx/coroutines/CoroutineScope.html">CoroutineScope</a>&nbsp;scope<br>)</pre>
<p>Operator which caches an <a href="[Observable]">Observable</a> of <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code> within a <code><a href="/reference/kotlinx/coroutines/CoroutineScope.html">CoroutineScope</a></code>.</p>
<p><code><a href="/reference/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/androidx/paging/PagingData.html">PagingData</a></code>, allowing multiple observers on the same instance of <code><a href="/reference/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/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/androidx/paging/PagingData.html">PagingData</a></code> emitted by <code><a href="/reference/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/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><a href="/reference/kotlinx/coroutines/CoroutineScope.html">CoroutineScope</a>&nbsp;scope</code></td>
<td width="100%">
<p>The <code><a href="/reference/kotlinx/coroutines/CoroutineScope.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/androidx/paging/PagingData.html">PagingData</a></code> stream is no longer needed. Otherwise, the provided <code><a href="/reference/kotlinx/coroutines/CoroutineScope.html">CoroutineScope</a></code> must be manually cancelled to avoid memory leaks.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="cachedIn(, kotlinx.coroutines.CoroutineScope)"></a><a name="cachedIn--kotlinx.coroutines.CoroutineScope-"></a>
<h3 class="api-name" id="cachedIn(,kotlinx.coroutines.CoroutineScope)">cachedIn</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/kotlin/OptIn.html">OptIn</a>(markerClass&nbsp;=&nbsp;[ExperimentalCoroutinesApi])<br>public&nbsp;static&nbsp;final&nbsp;<a href="/reference/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;<a href="/reference/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;&gt;&nbsp;&lt;T&nbsp;extends&nbsp;<a href="/reference/java/lang/Object.html">Object</a>&gt; <a href="/reference/androidx/paging/rxjava2/PagingRxKt.html#cachedIn(,kotlinx.coroutines.CoroutineScope)">cachedIn</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="/reference/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a>&lt;<a href="/reference/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;&gt;&nbsp;receiver,<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="/reference/kotlinx/coroutines/CoroutineScope.html">CoroutineScope</a>&nbsp;scope<br>)</pre>
<p>Operator which caches a <a href="[Flowable]">Flowable</a> of <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code> within a <code><a href="/reference/kotlinx/coroutines/CoroutineScope.html">CoroutineScope</a></code>.</p>
<p><code><a href="/reference/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/androidx/paging/PagingData.html">PagingData</a></code>, allowing multiple observers on the same instance of <code><a href="/reference/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/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/androidx/paging/PagingData.html">PagingData</a></code> emitted by <code><a href="/reference/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/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><a href="/reference/kotlinx/coroutines/CoroutineScope.html">CoroutineScope</a>&nbsp;scope</code></td>
<td width="100%">
<p>The <code><a href="/reference/kotlinx/coroutines/CoroutineScope.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/androidx/paging/PagingData.html">PagingData</a></code> stream is no longer needed. Otherwise, the provided <code><a href="/reference/kotlinx/coroutines/CoroutineScope.html">CoroutineScope</a></code> must be manually cancelled to avoid memory leaks.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
</html>