{"id":13305622,"url":"https://github.com/climacell/StatefulLiveData","last_synced_at":"2025-03-10T13:31:53.368Z","repository":{"id":46860495,"uuid":"228408115","full_name":"climacell/StatefulLiveData","owner":"climacell","description":"StatefulLiveData is a lean, yet powerful tool that harnesses the capabilities of LiveData and enhances them, enabling the observer to distinguish between different states the data can be in, such as Success, Loading and Error.","archived":false,"fork":false,"pushed_at":"2023-05-11T08:58:13.000Z","size":89,"stargazers_count":18,"open_issues_count":2,"forks_count":0,"subscribers_count":11,"default_branch":"master","last_synced_at":"2023-05-11T10:15:46.726Z","etag":null,"topics":["android","coroutines","google-tasks","livedata","retrofit","retrofit2","stateful","statefullivedata"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/climacell.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-16T14:42:51.000Z","updated_at":"2023-05-11T10:15:46.727Z","dependencies_parsed_at":"2024-10-23T12:08:23.959Z","dependency_job_id":null,"html_url":"https://github.com/climacell/StatefulLiveData","commit_stats":null,"previous_names":[],"tags_count":2,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/climacell%2FStatefulLiveData","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/climacell%2FStatefulLiveData/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/climacell%2FStatefulLiveData/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/climacell%2FStatefulLiveData/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/climacell","download_url":"https://codeload.github.com/climacell/StatefulLiveData/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242859676,"owners_count":20196980,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","coroutines","google-tasks","livedata","retrofit","retrofit2","stateful","statefullivedata"],"created_at":"2024-07-29T17:53:56.195Z","updated_at":"2025-03-10T13:31:53.088Z","avatar_url":"https://github.com/climacell.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# StatefulLiveData\n[![Release](https://jitpack.io/v/climacell/statefullivedata.svg?style=flat-square)](https://jitpack.io/#climacell/statefullivedata) [![API](https://img.shields.io/badge/API-14%2B-blue.svg?style=flat-square)](https://android-arsenal.com/api?level=14)\n\n**StatefulLiveData** is a lean, yet powerful tool that harnesses the capabilities of LiveData and enhances them, enabling the observer to distinguish between different states the data can be in, such as  ***Success***, ***Loading*** and ***Error***.\n\nStatefulLiveData is open-ended, which gives you possibility to create more types of StatefulData, as well as extensions and functionality.\n## Quick start guide\n### Setup\nAdding the dependency to the project using gradle or maven.\n\n#### Gradle setup\n```gradle\nrepositories {\n    maven { url 'https://jitpack.io' }\n}\n\ndependencies {\n    implementation 'com.github.climacell.statefullivedata:core:1.0.0'\n}\n```\n#### Maven setup\n```maven-pom\n\u003c!-- \u003crepositories\u003e section of pom.xml --\u003e\n\u003crepository\u003e\n    \u003cid\u003ejitpack.io\u003c/id\u003e\n   \u003curl\u003ehttps://jitpack.io\u003c/url\u003e\n\u003c/repository\u003e\n\n\u003c!-- \u003cdependencies\u003e section of pom.xml --\u003e\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.climacell.statefullivedata\u003c/groupId\u003e\n    \u003cartifactId\u003ecore\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n### Usage\n#### Create a StatefulLiveData object:\n```kotlin\nval myStatefulLiveData: MutableStatefulLiveData\u003cString\u003e = MutableStatefulLiveData\u003cString\u003e()\n```\n#### Observe:\n```kotlin\nmyStatefulLiveData.observe(lifecycleOwner, Observer { statefulData: StatefulData\u003cString\u003e -\u003e  \n\twhen (statefulData) {  \n\t\tis StatefulData.Success -\u003e {  \n\t\t\tshowMyData(statefulData.data)  \n\t\t}\n\t\tis StatefulData.Loading -\u003e {  \n\t\t\tshowProgressBar()  \n\t\t}\n\t\tis StatefulData.Error -\u003e {  \n\t\t\tshowError(statefulData.throwable)  \n\t\t} \n\t}\n})\n```\n#### Update states:\nPut success state\n```kotlin\nmyStatefulLiveData.putData(\"My data String.\") \n``` \nPut loading state\n```kotlin\nmyStatefulLiveData.putLoading()\n```\nPut error state\n```kotlin\nmyStatefulLiveData.putError(IllegalArgumentException())\n```\nThats it! You are ready to go! =)\n\nFor more awesome capabilities and other super powers check out the other modules that accompany the core module.\nAlso make sure to look at the kdoc in the library.\n\n## Documentation\nComing soon.\n## Modules\nThere are 4 modules comprising StatefulLiveData:\n - [Core](https://github.com/climacell/StatefulLiveData/tree/master/core) - The essential components of the StatefulLiveData framework.\n - [Coroutines](https://github.com/climacell/StatefulLiveData/tree/master/coroutines)  - Additional functionalities to further enhance StatefulLiveData with coroutines.\n - [Google-Tasks](https://github.com/climacell/StatefulLiveData/tree/master/google-tasks) - Provides easy conversions from Tasks to StatefulLiveData.\n - [Retrofit](https://github.com/climacell/StatefulLiveData/tree/master/retrofit) - A Retrofit adapter to convert calls to StatefulLiveData.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclimacell%2FStatefulLiveData","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclimacell%2FStatefulLiveData","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclimacell%2FStatefulLiveData/lists"}