are there any differences if in a Singleton class ...
# flow
g
are there any differences if in a Singleton class we expose a
Flow
from a public
val
than from a function that returns the
Flow
? Are there any other cases where the
val
is preferred over the function?
j
functions create a new instance, variable not (except if they use
get
)
f
I'd say that if the flow is cold and pure, the function fits best. If the flow consumes/uses and underlying resource or it's hot, then a property is fine. For example, a s stateflow is always a property, while Sequence.asFlow is a function.