russhwolf / multiplatform-settings

A Kotlin Multiplatform library for saving simple key-value data
Apache License 2.0
1.7k stars 67 forks source link

Remove by key multiplatform-settings-serialization #136

Closed blyscuit closed 1 year ago

blyscuit commented 1 year ago

multiplatform-settings-serialization saves value by combining the key parameter with the property name. and not possible to remove the values by sending key and value type.

Add support for, would be really appreciated.

settings.remove(
    serializer: KSerializer<T>,
    key: String
)

Currently I'm using this as a a workaround

    override fun remove(key: String) {
        settings
            .keys
            .filter { it.startsWith(key) }
            .map { settings.remove(it) }
    }
russhwolf commented 1 year ago

This is already being tracked in #81 and there's a draft implementation in #117