Created
May 15, 2020 05:31
-
-
Save AgiMaulana/76ab91bfb0c254daffef826502cc61f0 to your computer and use it in GitHub Desktop.
Non null Android Clean Architecture's LiveData
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
open class NonNullLiveData<T>(private val defaultValue: T) : LiveData<T>() { | |
override fun getValue(): T = super.getValue() ?: defaultValue | |
protected 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