This return type can be used to terminate future load requests on this PagingSource when the PagingSource is not longer valid due to changes in the underlying dataset.
For example, if the underlying database gets written into but the PagingSource does not invalidate in time, it may return inconsistent results if its implementation depends on the immutability of the backing dataset it loads from (e.g., LIMIT OFFSET style db implementations). In this scenario, it is recommended to check for invalidation after loading and to return LoadResult.Invalid, which causes Paging to discard any pending or future load requests to this PagingSource and invalidate it.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-07-10 UTC.
[null,null,["Last updated 2025-07-10 UTC."],[],[],null,["# PagingSource.LoadResult.Invalid\n===============================\n\nArtifact: [androidx.paging:paging-common](/jetpack/androidx/releases/paging) \n[View Source](https://cs.android.com/search?q=file:androidx/paging/PagingSource.kt+class:androidx.paging.PagingSource.LoadResult.Invalid) \nAdded in [3.1.0](/jetpack/androidx/releases/paging#3.1.0)\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/androidx/paging/PagingSource.LoadResult.Invalid \"View this page in Java\")\nCommon/AllAndroid/JVMNative/C/iOSJavaScript\n - Cmn \n\n ```\n class PagingSource.LoadResult.Invalid\u003cKey : Any, Value : Any\u003e : PagingSource.LoadResult\n``` \n\n|---|---|----------------------------------------------------------------------------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||\n| ↳ | [androidx.paging.PagingSource.LoadResult](/reference/kotlin/androidx/paging/PagingSource.LoadResult) ||\n| | ↳ | [androidx.paging.PagingSource.LoadResult.Invalid](/reference/kotlin/androidx/paging/PagingSource.LoadResult.Invalid) |\n\n*** ** * ** ***\n\nInvalid result object for [PagingSource.load](/reference/kotlin/androidx/paging/PagingSource#load(androidx.paging.PagingSource.LoadParams))\n\nThis return type can be used to terminate future load requests on this [PagingSource](/reference/kotlin/androidx/paging/PagingSource) when the [PagingSource](/reference/kotlin/androidx/paging/PagingSource) is not longer valid due to changes in the underlying dataset.\n\nFor example, if the underlying database gets written into but the [PagingSource](/reference/kotlin/androidx/paging/PagingSource) does not invalidate in time, it may return inconsistent results if its implementation depends on the immutability of the backing dataset it loads from (e.g., LIMIT OFFSET style db implementations). In this scenario, it is recommended to check for invalidation after loading and to return LoadResult.Invalid, which causes Paging to discard any pending or future load requests to this PagingSource and invalidate it.\n\nReturning [Invalid](/reference/kotlin/androidx/paging/PagingSource.LoadResult.Invalid) will trigger Paging to [invalidate](/reference/kotlin/androidx/paging/PagingSource#invalidate()) this [PagingSource](/reference/kotlin/androidx/paging/PagingSource) and terminate any future attempts to [load](/reference/kotlin/androidx/paging/PagingSource#load(androidx.paging.PagingSource.LoadParams)) from this [PagingSource](/reference/kotlin/androidx/paging/PagingSource)\n\nSummary\n-------\n\n| ### Public constructors |\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----|\n| `\u003cKey : `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`, Value : `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`\u003e `[Invalid](/reference/kotlin/androidx/paging/PagingSource.LoadResult.Invalid#Invalid())`()` | Cmn |\n\n| ### Public functions |\n|------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------|-----|\n| `open `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html) | [toString](/reference/kotlin/androidx/paging/PagingSource.LoadResult.Invalid#toString())`()` | Cmn |\n\nPublic constructors\n-------------------\n\n### Invalid\n\nCmn \n\n```\n\u003cKey : Any, Value : Any\u003e Invalid()\n```\n\nPublic functions\n----------------\n\n### toString\n\nCmn \n\n```\nopen fun toString(): String\n```"]]