I have third-party sdk which uses multi-shot callb...
# coroutines
s
I have third-party sdk which uses multi-shot callbacks extensively, in most cases those callbacks return primitive data types. To implement business logic rules I want to use flows with domain layer models. To do that I plan to use
callbackFlow
for every callback (tens or even hundreds of them), and then to use
combine
to produce models of domain layer (each model uses data from up to 10 different callbacks). Is this the best way to achieve that or I miss something and there is better approach?
d
Sounds good, keep in mind
combine
will only fire once all input flow sent at least 1 value.
u
Absolutely. Rule of thumb: Do the absolute minimum in
callbackFlow { }
and rather add transforms downstream.