
Feature-flag SDK for shared code: runtime flag management with DataStore persistence, Gradle-generated feature factories, Compose-based debug inspector, and Hyperion-compatible debug entry.
Fork notice. This is a Kotlin Multiplatform fork of MiSikora/laboratory. The original project — authored by Michał Sikora — is Android-only and the canonical source of the design, documentation, and changelog. Please consult the original project website for conceptual docs; this README covers only what differs in the KMP fork.
Feature flags for Kotlin Multiplatform projects — one SDK that works on Android, iOS, and JVM from commonMain.
laboratory) replaces the per-module :runtime / :data-store / :shared-preferences split from 2.x. DataStore (Okio) is the only storage backend; SharedPreferences support has been removed.KClass<out Feature<*>> instead of Class<out Feature<*>>. Call sites change from AuthType::class.java to AuthType::class. Breaking vs. the original 2.x.:inspector-cmp) is available for both Android and iOS. On iOS it's exposed as a single-call UIViewController factory.commonMain.The fork is distributed via Maven Central under the io.github.vudzkostek namespace. No CocoaPods — because KMP consumers (both Android and iOS targets inside a shared Kotlin module) resolve the per-target klibs through Gradle, so CocoaPods is only needed for pure-Swift consumers who don't use KMP. If that becomes a need later, we can add a GitHub-Release-hosted XCFramework + hand-maintained podspec.
// settings.gradle.kts
dependencyResolutionManagement {
repositories {
mavenCentral()
google()
}
}
pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal()
}
}// shared/build.gradle.kts
plugins {
kotlin("multiplatform")
id("io.github.vudzkostek.laboratory") version "<VERSION>"
}
kotlin {
sourceSets {
commonMain.dependencies {
// SDK — gives you Feature, Laboratory, Storage, FeatureFactory on all platforms.
implementation("io.github.vudzkostek:laboratory:<VERSION>")
// Compose Multiplatform debug inspector. Pull it into a debug-only variant if your build
// supports that (e.g. a dedicated commonDebugMain source set).
implementation("io.github.vudzkostek:inspector-cmp:<VERSION>")
}
androidMain.dependencies {
// Android-only Hyperion debug menu entry (optional). Pulls in the original Views inspector.
debugImplementation("io.github.vudzkostek:laboratory-hyperion-plugin:<VERSION>")
}
}
}
laboratory {
packageName = "com.example.flags"
feature("AuthType") {
withDefaultOption("Fingerprint")
withOption("None")
withOption("Retina")
withOption("Face")
}
featureFactory()
}Replace <VERSION> with a published release (e.g. 1.0.1). The gradle plugin uses the same version for its generated api(...) dep by default; override via a laboratory.libraryCoordinate project property if you ever publish Laboratory somewhere else.
enum class AuthType : Feature<AuthType> {
None, Fingerprint, Retina, Face;
override val defaultOption get() = Fingerprint
}val laboratory = Laboratory.builder()
.localStorage(storage) // Storage.dataStore(context) on Android, Storage.dataStore() on iOS
.featureFactory(FeatureFactory.generated()) // generated by the Gradle plugin
.build()
val current = laboratory.experiment<AuthType>()
laboratory.setOption(AuthType.Face)
laboratory.observe<AuthType>()
.onEach { option -> println("AuthType: $option") }
.launchIn(scope)Android — via Compose (any Compose host):
setContent {
LaboratoryInspector(
configuration = LaboratoryConfiguration(
laboratory = laboratory,
featureFactories = mapOf("Features" to FeatureFactory.generated()),
),
)
}Android — via Hyperion:
The Hyperion menu entry is automatic once you add the hyperion-plugin dep. It opens the original Views inspector — identical UX to the 2.x release.
iOS — from your KMP shared module:
// shared/src/iosMain/.../DebugTools.kt
fun showLaboratory(
laboratory: Laboratory,
factory: FeatureFactory,
): UIViewController = LaboratoryViewController(
configuration = LaboratoryConfiguration(
laboratory = laboratory,
featureFactories = mapOf("Features" to factory),
),
)Call it from Swift via your own umbrella framework:
let vc = SharedKt.showLaboratory(laboratory: lab, factory: factory)
present(vc, animated: true)samples/basic, samples/default-option, samples/multi-module — original Android samples, updated for the KClass API, still using the Views inspector + Hyperion.samples/kmp — new KMP sample demonstrating Android + iOS consumption through the shared SDK and the Compose inspector.The underlying migration plan lives in KMP_MIGRATION_PLAN.md — six phases, each independently buildable, with session notes for the context behind each decision.
Copyright 2020 Michał Sikora
Copyright 2026 Artur Kosta (KMP fork contributions)
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
Fork notice. This is a Kotlin Multiplatform fork of MiSikora/laboratory. The original project — authored by Michał Sikora — is Android-only and the canonical source of the design, documentation, and changelog. Please consult the original project website for conceptual docs; this README covers only what differs in the KMP fork.
Feature flags for Kotlin Multiplatform projects — one SDK that works on Android, iOS, and JVM from commonMain.
laboratory) replaces the per-module :runtime / :data-store / :shared-preferences split from 2.x. DataStore (Okio) is the only storage backend; SharedPreferences support has been removed.KClass<out Feature<*>> instead of Class<out Feature<*>>. Call sites change from AuthType::class.java to AuthType::class. Breaking vs. the original 2.x.:inspector-cmp) is available for both Android and iOS. On iOS it's exposed as a single-call UIViewController factory.commonMain.The fork is distributed via Maven Central under the io.github.vudzkostek namespace. No CocoaPods — because KMP consumers (both Android and iOS targets inside a shared Kotlin module) resolve the per-target klibs through Gradle, so CocoaPods is only needed for pure-Swift consumers who don't use KMP. If that becomes a need later, we can add a GitHub-Release-hosted XCFramework + hand-maintained podspec.
// settings.gradle.kts
dependencyResolutionManagement {
repositories {
mavenCentral()
google()
}
}
pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal()
}
}// shared/build.gradle.kts
plugins {
kotlin("multiplatform")
id("io.github.vudzkostek.laboratory") version "<VERSION>"
}
kotlin {
sourceSets {
commonMain.dependencies {
// SDK — gives you Feature, Laboratory, Storage, FeatureFactory on all platforms.
implementation("io.github.vudzkostek:laboratory:<VERSION>")
// Compose Multiplatform debug inspector. Pull it into a debug-only variant if your build
// supports that (e.g. a dedicated commonDebugMain source set).
implementation("io.github.vudzkostek:inspector-cmp:<VERSION>")
}
androidMain.dependencies {
// Android-only Hyperion debug menu entry (optional). Pulls in the original Views inspector.
debugImplementation("io.github.vudzkostek:laboratory-hyperion-plugin:<VERSION>")
}
}
}
laboratory {
packageName = "com.example.flags"
feature("AuthType") {
withDefaultOption("Fingerprint")
withOption("None")
withOption("Retina")
withOption("Face")
}
featureFactory()
}Replace <VERSION> with a published release (e.g. 1.0.1). The gradle plugin uses the same version for its generated api(...) dep by default; override via a laboratory.libraryCoordinate project property if you ever publish Laboratory somewhere else.
enum class AuthType : Feature<AuthType> {
None, Fingerprint, Retina, Face;
override val defaultOption get() = Fingerprint
}val laboratory = Laboratory.builder()
.localStorage(storage) // Storage.dataStore(context) on Android, Storage.dataStore() on iOS
.featureFactory(FeatureFactory.generated()) // generated by the Gradle plugin
.build()
val current = laboratory.experiment<AuthType>()
laboratory.setOption(AuthType.Face)
laboratory.observe<AuthType>()
.onEach { option -> println("AuthType: $option") }
.launchIn(scope)Android — via Compose (any Compose host):
setContent {
LaboratoryInspector(
configuration = LaboratoryConfiguration(
laboratory = laboratory,
featureFactories = mapOf("Features" to FeatureFactory.generated()),
),
)
}Android — via Hyperion:
The Hyperion menu entry is automatic once you add the hyperion-plugin dep. It opens the original Views inspector — identical UX to the 2.x release.
iOS — from your KMP shared module:
// shared/src/iosMain/.../DebugTools.kt
fun showLaboratory(
laboratory: Laboratory,
factory: FeatureFactory,
): UIViewController = LaboratoryViewController(
configuration = LaboratoryConfiguration(
laboratory = laboratory,
featureFactories = mapOf("Features" to factory),
),
)Call it from Swift via your own umbrella framework:
let vc = SharedKt.showLaboratory(laboratory: lab, factory: factory)
present(vc, animated: true)samples/basic, samples/default-option, samples/multi-module — original Android samples, updated for the KClass API, still using the Views inspector + Hyperion.samples/kmp — new KMP sample demonstrating Android + iOS consumption through the shared SDK and the Compose inspector.The underlying migration plan lives in KMP_MIGRATION_PLAN.md — six phases, each independently buildable, with session notes for the context behind each decision.
Copyright 2020 Michał Sikora
Copyright 2026 Artur Kosta (KMP fork contributions)
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