HomeObjectsFlow

class HomeObjectsFlow<T : HasId> : Flow


A Flow of a Set of home objects. A new value is emitted on the flow whenever any object in the set changes.

list, itemFlow, and get are provided as convenience methods for common operations.

Summary

Public functions

suspend T?
get(id: Id)

Gets the latest value of the home object with the corresponding Id and terminates the subscription.

Flow<T>
itemFlow(id: Id)

Creates a filtered flow of distinct items given an Id.

Flow<T>
itemFlow(item: T)

Creates a filtered flow of items that match the item type.

suspend Set<T>

Gets the latest value of the home objects and terminates the subscription.

Public properties

Flow<Set<T>>

the Set of home objects used by the Flow.

Inherited functions

From kotlinx.coroutines.flow.Flow
open suspend Unit
collect(collector: FlowCollector<Set<T>>)

Public functions

get

suspend fun get(id: Id): T?

Gets the latest value of the home object with the corresponding Id and terminates the subscription.

Parameters
id: Id

the ID of the item to get.

Returns
T?

the latest value of the item.

itemFlow

fun itemFlow(id: Id): Flow<T>

Creates a filtered flow of distinct items given an Id.

Parameters
id: Id

the ID of the item to create a flow for.

Returns
Flow<T>

the filtered flow.

itemFlow

fun itemFlow(item: T): Flow<T>

Creates a filtered flow of items that match the item type.

Parameters
item: T

the item type to create a flow for.

Returns
Flow<T>

the filtered flow.

list

suspend fun list(): Set<T>

Gets the latest value of the home objects and terminates the subscription.

Returns
Set<T>

the latest value of the item.

Public properties

flow

val flowFlow<Set<T>>

the Set of home objects used by the Flow.