// Created on savesnippets.com ยท https://savesnippets.com/hcouMGg8JXquno class UserConfig(map: MutableMap) { var theme: String by map var notifications: Boolean by map var refreshIntervalSec: Int by map } fun main() { val raw = mutableMapOf( "theme" to "dark", "notifications" to true, "refreshIntervalSec" to 60, ) val cfg = UserConfig(raw) println(cfg.theme) // dark println(cfg.notifications) // true cfg.theme = "light" // also updates `raw` println(raw["theme"]) // light // Same trick works for immutable read-only: class ReadOnlyConfig(map: Map) { val theme: String by map } }