mirror of
https://github.com/Shabinder/SpotiFlyer.git
synced 2024-11-22 09:04:32 +01:00
AutoClear init fix
This commit is contained in:
parent
43ca70daf7
commit
79ad318264
@ -28,7 +28,8 @@ class AutoClear<T : Any?>(
|
|||||||
get() = observer.value
|
get() = observer.value
|
||||||
set(value) { observer.value = value }
|
set(value) { observer.value = value }
|
||||||
|
|
||||||
val value: T get() = _value.requireNotNull()
|
val value: T get() = _value ?: initializer?.invoke()
|
||||||
|
?: throw IllegalStateException("The value has not yet been set or no default initializer provided")
|
||||||
|
|
||||||
fun getOrNull(): T? = _value
|
fun getOrNull(): T? = _value
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user