我想要一个在列表更新/更改时发出Flow<List<T>>
的流.
case 1:
var l = listOf(1, 2, 3, 5)
val listFlowOfInt : Flow<List<Int>> = // A flow which will notify All subscribers (emit value) when l is re-assigned,
//say l= listOf(6,7,8), elsewhere in the code.
或者, case 2:
val l = mutableListOf(1, 2, 3, 5)
val listFlowOfInt : Flow<List<Int>> = // A flow which will notify All subscribers (emit value) when l is changed,
//say l.add(6), elsewhere in the code.