Vivek Sharma
02/08/2021, 1:32 PMwasyl
02/08/2021, 1:35 PMfirst()
does exactly what it says, returns the first element, or throws if the flow completes before emitting anythingwasyl
02/08/2021, 1:36 PMFlow<List<T>>
then first()
will still do the same thing, if nothing is emitted and the flow completes then first()
will throw an exception. If the flow emits a value, it will return that valuewasyl
02/08/2021, 1:36 PMVivek Sharma
02/08/2021, 1:46 PMfirst()
throw exception ?Vivek Sharma
02/08/2021, 1:48 PMwasyl
02/08/2021, 1:48 PMwasyl
02/08/2021, 1:49 PMval result = flowOf(emptyList<String>())
.first()
println(result)
gildor
02/08/2021, 1:51 PMVivek Sharma
02/08/2021, 2:09 PM