Last active
May 15, 2020 05:32
-
-
Save AgiMaulana/bf51c5e3b5f3a59939e50b315068decc to your computer and use it in GitHub Desktop.
Non null Android Clean Architecture's MutableLiveData
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NonNullMutableLiveData<T>(private val defaultValue: T) : NonNullLiveData<T>(defaultValue) { | |
public override fun getValue(): T = super.getValue() ?: defaultValue | |
public override fun setValue(value: T) = super.setValue(value) | |
public override fun postValue(value: T) = super.postValue(value) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment