
Utility library simplifies development by offering platform-specific tools and shared abstractions for managing coroutine dispatchers, accessing platform details, handling preferences, and launching URLs across Compose environments.
ComposeUtils is a utility library designed to streamline development in Compose Multiplatform projects. This package provides a set of platform-specific utilities and shared abstractions tailored for use in Compose environments across Android, iOS, and other platforms supported by Kotlin Multiplatform. With tools for managing coroutine dispatchers, accessing platform information, handling preferences, and launching URLs, ComposeUtils simplifies cross-platform development by offering consistent, easy-to-use interfaces and functions that work seamlessly in Compose-based projects.
Compose Utils Core
β Compose Utils Core
Compose Utils Navigation
β Compose Utils Navigation
Network Connectivity
β Network Connectivity
Ktor Error Handling
β Compose Ktor Error Handler
This library is no longer maintained or updated.
You are free to copy and reuse its source code as needed.
Feel free to adapt the logic to match your API error response structure and validation format.
openUrl("https://maps.app.goo.gl/qnPYcxLP9Y9Y74od8")expect class SharedPrefs() {
fun putInt(key: String, value: Int)
fun putString(key: String, value: String)
fun putBool(key: String, value: Boolean)
fun getInt(key: String, default: Int?): Int
fun getString(key: String): String?
fun getBool(key: String, default: Boolean?): Boolean
fun remove(key: String)
} val prefs = SharedPrefs()
...
ElevatedButton(onClick = {
prefs.putInt() // or any function need
})expect class PlatformData() {
val name: String
val deviceName: String
val version: String
val model: String
val manufacturer: String
} val platformData = PlatformData()
...
ElevatedButton(onClick = {
println(platformData.name)
})KtorErrorHandler().init()internal class GetLecturesFilterRepository(
private val remoteDataSource: RemoteDataSource
) {
suspend fun invoke(lecturesFilterRequest: LecturesFilterRequest): Either<Failure, LecturesFilterModel> {
return try {
val result = remoteDataSource.getLecturesFilter(lecturesFilterRequest)
val data = result.toModel()
Either.Right(data)
} catch (e: Exception) {
Either.Left(KtorErrorHandler().handle(e))
}
}
} val result = loginUseCase.invoke(loginRequest)
result.fold(
right = {
data = it
},
left = {
state.value = state.value.copy(errorMessage = (it as Map)["errorMessage"],
errorForm = (it as Map)["invalid fields"])
}
)
ComposeUtils is a utility library designed to streamline development in Compose Multiplatform projects. This package provides a set of platform-specific utilities and shared abstractions tailored for use in Compose environments across Android, iOS, and other platforms supported by Kotlin Multiplatform. With tools for managing coroutine dispatchers, accessing platform information, handling preferences, and launching URLs, ComposeUtils simplifies cross-platform development by offering consistent, easy-to-use interfaces and functions that work seamlessly in Compose-based projects.
Compose Utils Core
β Compose Utils Core
Compose Utils Navigation
β Compose Utils Navigation
Network Connectivity
β Network Connectivity
Ktor Error Handling
β Compose Ktor Error Handler
This library is no longer maintained or updated.
You are free to copy and reuse its source code as needed.
Feel free to adapt the logic to match your API error response structure and validation format.
openUrl("https://maps.app.goo.gl/qnPYcxLP9Y9Y74od8")expect class SharedPrefs() {
fun putInt(key: String, value: Int)
fun putString(key: String, value: String)
fun putBool(key: String, value: Boolean)
fun getInt(key: String, default: Int?): Int
fun getString(key: String): String?
fun getBool(key: String, default: Boolean?): Boolean
fun remove(key: String)
} val prefs = SharedPrefs()
...
ElevatedButton(onClick = {
prefs.putInt() // or any function need
})expect class PlatformData() {
val name: String
val deviceName: String
val version: String
val model: String
val manufacturer: String
} val platformData = PlatformData()
...
ElevatedButton(onClick = {
println(platformData.name)
})KtorErrorHandler().init()internal class GetLecturesFilterRepository(
private val remoteDataSource: RemoteDataSource
) {
suspend fun invoke(lecturesFilterRequest: LecturesFilterRequest): Either<Failure, LecturesFilterModel> {
return try {
val result = remoteDataSource.getLecturesFilter(lecturesFilterRequest)
val data = result.toModel()
Either.Right(data)
} catch (e: Exception) {
Either.Left(KtorErrorHandler().handle(e))
}
}
} val result = loginUseCase.invoke(loginRequest)
result.fold(
right = {
data = it
},
left = {
state.value = state.value.copy(errorMessage = (it as Map)["errorMessage"],
errorForm = (it as Map)["invalid fields"])
}
)