Lilly
11/09/2021, 11:07 AMflow
operator for functions returning a single value. What's the purpose of doing this? Are there any benefits by doing this?mbonnin
11/09/2021, 11:09 AMretry
, catch
, etc...Lilly
11/09/2021, 11:10 AMBig Chungus
11/09/2021, 11:12 AMBig Chungus
11/09/2021, 11:13 AMLilly
11/09/2021, 11:13 AMMarko Novakovic
11/09/2021, 11:19 AMFlow
it will update regularly whenever dat changes. maybe you overlook something. sometimes people use it just because it looks cool, best to evaluate your own usecasesLilly
11/09/2021, 11:21 AMsometimes people use it just because it looks cool,Yeah that's what I also thought first ๐
Marko Novakovic
11/09/2021, 11:22 AMmbonnin
11/09/2021, 11:23 AMLilly
11/09/2021, 11:33 AMyschimke
11/09/2021, 1:45 PMAdam Powell
11/09/2021, 1:53 PMsuspend () -> T
is right thereJoffrey
11/09/2021, 2:20 PMJoffrey
11/09/2021, 2:21 PMIt would for consistency. If you use flow elsewhere, your code will be much easier to parse and reason about if everything is done with flows@Big Chungus I do believe the opposite of this, so I guess yeah it's matter of preference. Using flows everywhere you can't know anymore what's supposed to give you a single value, or if this will be updated in the future and more values may come.
mcpiroman
11/09/2021, 2:30 PMAdam Powell
11/09/2021, 2:54 PMObservable
everywhere for consistency, even in places where Single
or Maybe
are a better fitLilly
11/09/2021, 3:05 PMyschimke
11/10/2021, 8:39 AMyschimke
11/10/2021, 8:45 AMval me = dao.getMe().shareIn(viewModelScope, SharingStarted.WhileSubscribed(5000))
Joffrey
11/10/2021, 10:41 AMflow { emit(callSuspendStuff()) }
. In this case, just expose the suspend function. If your function does support update events, then expose a Flow
of course. And users can use the first value if they want, or subscribe for more. But if the flow is defined to emit only one element, this is basically lying in the API.Joffrey
11/10/2021, 10:43 AMyschimke
11/10/2021, 2:01 PMdarkmoon_uk
11/11/2021, 1:29 AMFlow
then that's okay too - it's not just to look cool ๐darkmoon_uk
11/11/2021, 1:30 AMLilly
11/23/2021, 4:41 PM