{"id":13902309,"url":"https://github.com/tfcporciuncula/flow-preferences","last_synced_at":"2026-01-14T02:13:23.858Z","repository":{"id":37587980,"uuid":"216426553","full_name":"tfcporciuncula/flow-preferences","owner":"tfcporciuncula","description":"Kotlin Flow version of rx-preferences -- Coroutines support for Android SharedPreferences","archived":false,"fork":false,"pushed_at":"2023-10-16T10:36:30.000Z","size":334,"stargazers_count":250,"open_issues_count":0,"forks_count":21,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-18T03:30:54.263Z","etag":null,"topics":["android","coroutines","flow","kotlin","kotlin-coroutines","kotlin-flow","preferences"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tfcporciuncula.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}},"created_at":"2019-10-20T20:57:50.000Z","updated_at":"2025-06-26T07:24:29.000Z","dependencies_parsed_at":"2023-02-09T15:30:42.756Z","dependency_job_id":"7d44bf58-f09c-47f9-b0e5-aab07ce77f65","html_url":"https://github.com/tfcporciuncula/flow-preferences","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/tfcporciuncula/flow-preferences","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tfcporciuncula%2Fflow-preferences","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tfcporciuncula%2Fflow-preferences/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tfcporciuncula%2Fflow-preferences/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tfcporciuncula%2Fflow-preferences/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tfcporciuncula","download_url":"https://codeload.github.com/tfcporciuncula/flow-preferences/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tfcporciuncula%2Fflow-preferences/sbom","scorecard":{"id":875809,"data":{"date":"2025-08-11","repo":{"name":"github.com/tfcporciuncula/flow-preferences","commit":"3ab525fc7788a422871b118fda9c4a19f1054df7"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":1,"reason":"Found 3/30 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:48: update your workflow using https://app.stepsecurity.io/secureworkflow/tfcporciuncula/flow-preferences/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:51: update your workflow using https://app.stepsecurity.io/secureworkflow/tfcporciuncula/flow-preferences/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:56: update your workflow using https://app.stepsecurity.io/secureworkflow/tfcporciuncula/flow-preferences/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:62: update your workflow using https://app.stepsecurity.io/secureworkflow/tfcporciuncula/flow-preferences/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/tfcporciuncula/flow-preferences/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/tfcporciuncula/flow-preferences/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/tfcporciuncula/flow-preferences/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/tfcporciuncula/flow-preferences/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:34: update your workflow using https://app.stepsecurity.io/secureworkflow/tfcporciuncula/flow-preferences/ci.yml/master?enable=pin","Info:   0 out of   7 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Binary-Artifacts","score":9,"reason":"binaries present in source code","details":["Warn: binary detected: gradle/wrapper/gradle-wrapper.jar:1"],"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 3 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-24T05:56:53.678Z","repository_id":37587980,"created_at":"2025-08-24T05:56:53.678Z","updated_at":"2025-08-24T05:56:53.678Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408711,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","flow","kotlin","kotlin-coroutines","kotlin-flow","preferences"],"created_at":"2024-08-06T22:01:05.670Z","updated_at":"2026-01-14T02:13:23.843Z","avatar_url":"https://github.com/tfcporciuncula.png","language":"Kotlin","funding_links":[],"categories":["Kotlin"],"sub_categories":[],"readme":"[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.fredporciuncula/flow-preferences/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.fredporciuncula/flow-preferences)\n[![Build Status](https://github.com/tfcporciuncula/flow-preferences/workflows/CI/badge.svg)](https://github.com/tfcporciuncula/flow-preferences/actions?query=workflow%3ACI)\n[![ktlint](https://img.shields.io/badge/code%20style-%E2%9D%A4-FF4081.svg)](https://ktlint.github.io/)\n\n# Flow Preferences\n\nThis is the [Kotlin Flow](https://kotlinlang.org/docs/reference/coroutines/flow.html) version of\n[rx-preferences](https://github.com/f2prateek/rx-preferences). It follows pretty much the same API and\nshould feel familiar to anyone with experience there. But instead of RxJava,\nwe have [Coroutines](https://kotlinlang.org/docs/reference/coroutines/coroutines-guide.html) -- mainly Flows.\n\n## Download\n\n```groovy\nrepositories {\n  mavenCentral()\n}\n\ndependencies {\n  implementation 'com.fredporciuncula:flow-preferences:1.9.1'\n}\n```\n\n## How it looks like\n\nStart with the regular `SharedPreferences`:\n\n```kotlin\nval sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)\n```\n\nCreate an instance of `FlowSharedPreferences` from that:\n\n```kotlin\nval flowSharedPreferences = FlowSharedPreferences(sharedPreferences)\n```\n\nGet a preference:\n\n```kotlin\nval myPref = flowSharedPreferences.getInt(\"key\", defaultValue = 10)\n```\n\nGo with the Flow:\n\n```kotlin\nmyPref.asFlow().onEach { print(it) }.launchIn(scope)\n\n```\n\n## Extras\n\n### Set and commit support\n\nPreferences expose the regular `get()` and `put()` (named as `set()`) functions from `SharedPreferences`.\nBut in addition to that, they also expose the `suspend` `setAndCommit()` function that puts the value and performs a\ncommit in case you must ensure the preference is persisted right away. There's also a `deleteAndCommit()`.\n\n### Collector support\n\nYou can call `asCollector()` to ask a\n[`FlowCollector`](https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow-collector/)\nfrom a preference. You can then persist values from a Flow directly to the preference:\n\n```kotlin\nval flow = flow { emit(1) }\n\nscope.launch {\n  myPref.asCollector().emitAll(flow)\n}\n```\n\nYou can use `asSyncCollector()` if you want to put **and commit** the value (like `setAndCommit()`) on each emission.\n\n### Enum support\n\nEnum classes work out of the box and are persisted as strings based on their `name` value (so make sure you `@Keep` them\nif you're using R8):\n\n```kotlin\nenum class MyEnum { A, B, C }\n\nval myPref = flowSharedPreferences.getEnum(\"key\", defaultValue = MyEnum.A)\n```\n\n### Object support\n\nArbitrary objects are also supported as long as an instance of `ObjectPreference.Serializer` is provided:\n\n```kotlin\nclass TestObject(val id: Int)\n\nval serializer =\n  object : ObjectPreference.Serializer\u003cTestObject\u003e {\n    override fun deserialize(serialized: String) = TestObject(serialized.toInt())\n    override fun serialize(value: TestObject) = value.id.toString()\n  }\n\nval myPref = flowSharedPreferences.getObject(\"key\", serializer, defaultValue = TestObject(0))\n```\n\n### Explicit nullability support\n\nBy default, strings, objects, enums and sets can never be `null`, so consumers don't ever have to worry about\n`null` checks. If you want to support nullable values, you can explicitly opt in by asking for the\nnullable-friendly preference types:\n\n```kotlin\nval nullableStringPreference = flowSharedPreferences.getNullableString(\"key\", defaultValue = null)\n```\n\n# ⁕\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftfcporciuncula%2Fflow-preferences","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftfcporciuncula%2Fflow-preferences","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftfcporciuncula%2Fflow-preferences/lists"}