Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

representation of an asynchronous load of a data with kotlin flow

License

NotificationsYou must be signed in to change notification settings

floschu/lce-data

Repository files navigation

versionbuildlicense

representation of an asynchronous load of a data with support of kotlin flow

installation

repositories {    jcenter()}dependencies {    implementation("at.florianschuster.data:lce-data:$version")}

concept

val uninitializedData=Data.Uninitializedval loadingData=Data.Loadingval successData=Data.Success(/*some value*/)val failureData=Data.Failure(/*some throwable*/)val evaluatedData=Data {/*some operation*/ }if (evaluatedDataisData.Success) {val dataValue= evaluatedData()}val suspendedData= dataOf {/*some suspending operation*/ }val flowData= dataFlowOf {/*some suspending operation*/ }

possible use case

suspendfunloadBooks():List<Book>classModel {val bookList= dataFlowOf { loadBooks() }}classView {privateval model=Model()init {        model.bookList.onEach {            loadingIndicator.isVisible= itisData.Loadingwhen(it) {isData.Success-> {/*update ui*/ }isData.Failure-> {/*show error*/ }            }        }.launchIn(someScope)    }}

author

visit mywebsite.

About

representation of an asynchronous load of a data with kotlin flow

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp