Skip to content

Commit

Permalink
Added nullLiveData that is constant LiveData initialized with null
Browse files Browse the repository at this point in the history
  • Loading branch information
c-b-h committed May 8, 2020
1 parent 4cc88b1 commit 5eea53b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lives/src/main/java/se/ingenuity/lives/Lives.kt
Original file line number Diff line number Diff line change
Expand Up @@ -202,4 +202,9 @@ object Lives {
internal object EmptyLiveData : LiveData<Nothing>()

@Suppress("UNCHECKED_CAST")
fun <T> emptyLiveData(): LiveData<T> = EmptyLiveData as LiveData<T>
fun <T> emptyLiveData(): LiveData<T> = EmptyLiveData as LiveData<T>

internal object NullLiveData : LiveData<Any?>(null)

@Suppress("UNCHECKED_CAST")
fun <T> nullLiveData(): LiveData<T?> = NullLiveData as LiveData<T?>

0 comments on commit 5eea53b

Please sign in to comment.