
Event and result observation with DataResult, LiveData/Flow wrappers, chaining/mapping/merge helpers and a Compose-first DSL for declarative loading, data, error and collection handling.
Kotlin-first event and result observation for Android and Compose Multiplatform.
The project is split into two public modules:
event-observer for DataResult, ResponseLiveData, ResponseFlow, and the supporting
utilitiesevent-observer-compose for ComposableDataResult and the Compose-facing observation DSLThe library centers on DataResult<T> and a small set of wrappers that keep loading, success,
error, and list-state handling consistent across Android and Compose layers.
Use event-observer when you want:
DataResult helpers and status handlingResponseLiveData, MutableResponseLiveData, and SwapResponseLiveData
ResponseFlow, ResponseStateFlow, and ResponseSharedFlow
Use event-observer-compose when you want:
ComposableDataResult for declarative state renderingcollectAsComposableState() for Flow<DataResult<T>> and LiveData<DataResult<T>>
OnData, OnError, OnShowLoading, OnEmpty, OnNotEmpty,
OnSingle, and OnMany
event-observer
Pick the module that matches your layer:
dependencies {
implementation("io.github.matheus-corregiari:event-observer:<version>")
}dependencies {
implementation("io.github.matheus-corregiari:event-observer-compose:<version>")
}event-observer-compose builds on top of event-observer, so use both only when you need
Compose rendering on top of the base result model.
event-observer
event-observer-compose
ComposableDataResultUse only event-observer when your UI layer is not Compose. Add event-observer-compose when the
final observation point lives inside Jetpack Compose Multiplatform.
The fastest path is to start with DataResult and render it where you need it.
val result = dataResultSuccess("Hello")
result.unwrap {
data { value -> println(value) }
error { throwable -> println(throwable.message) }
loading { isLoading -> println("loading=$isLoading") }
}For Compose, convert the upstream state into a ComposableDataResult and render the blocks you care
about.
myFlow.composable
.OnShowLoading { CircularProgressIndicator() }
.OnData { value -> Text(value.toString()) }
.OnError { error -> Text(error.message ?: "Unknown error") }
.Unwrap()Public docs live in docs/:
The published MkDocs site is built from the same content and mirrors these pages.
event-observer is Android-facing and integrates with LiveData.event-observer-compose builds on top of event-observer, Flow, and Compose state.Read CONTRIBUTING.md before sending changes.
Copyright 2025 Matheus Corregiari
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Kotlin-first event and result observation for Android and Compose Multiplatform.
The project is split into two public modules:
event-observer for DataResult, ResponseLiveData, ResponseFlow, and the supporting
utilitiesevent-observer-compose for ComposableDataResult and the Compose-facing observation DSLThe library centers on DataResult<T> and a small set of wrappers that keep loading, success,
error, and list-state handling consistent across Android and Compose layers.
Use event-observer when you want:
DataResult helpers and status handlingResponseLiveData, MutableResponseLiveData, and SwapResponseLiveData
ResponseFlow, ResponseStateFlow, and ResponseSharedFlow
Use event-observer-compose when you want:
ComposableDataResult for declarative state renderingcollectAsComposableState() for Flow<DataResult<T>> and LiveData<DataResult<T>>
OnData, OnError, OnShowLoading, OnEmpty, OnNotEmpty,
OnSingle, and OnMany
event-observer
Pick the module that matches your layer:
dependencies {
implementation("io.github.matheus-corregiari:event-observer:<version>")
}dependencies {
implementation("io.github.matheus-corregiari:event-observer-compose:<version>")
}event-observer-compose builds on top of event-observer, so use both only when you need
Compose rendering on top of the base result model.
event-observer
event-observer-compose
ComposableDataResultUse only event-observer when your UI layer is not Compose. Add event-observer-compose when the
final observation point lives inside Jetpack Compose Multiplatform.
The fastest path is to start with DataResult and render it where you need it.
val result = dataResultSuccess("Hello")
result.unwrap {
data { value -> println(value) }
error { throwable -> println(throwable.message) }
loading { isLoading -> println("loading=$isLoading") }
}For Compose, convert the upstream state into a ComposableDataResult and render the blocks you care
about.
myFlow.composable
.OnShowLoading { CircularProgressIndicator() }
.OnData { value -> Text(value.toString()) }
.OnError { error -> Text(error.message ?: "Unknown error") }
.Unwrap()Public docs live in docs/:
The published MkDocs site is built from the same content and mirrors these pages.
event-observer is Android-facing and integrates with LiveData.event-observer-compose builds on top of event-observer, Flow, and Compose state.Read CONTRIBUTING.md before sending changes.
Copyright 2025 Matheus Corregiari
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.