- Notifications
You must be signed in to change notification settings - Fork1
representation of an asynchronous load of a data with kotlin flow
License
NotificationsYou must be signed in to change notification settings
floschu/lce-data
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
representation of an asynchronous load of a data with support of kotlin flow
repositories { jcenter()}dependencies { implementation("at.florianschuster.data:lce-data:$version")}
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*/ }
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) }}
visit mywebsite.
About
representation of an asynchronous load of a data with kotlin flow
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.