How to transform/update one flow depending on another flow?

Viewed 1120

I have a two flows. One is a list of products updated by network calls and the second flow is a list of products read from a local SQLite database (using Room).

Storefront flow

Get all products  --- Network ---\
Search products   --- Network ------- List<Products> ---> data class Cart ---> Flow<List<Product>>
Filter products   --- Network ---/

Cart flow

Load Cart from SQLite --- Room ------ Flow ---> Flow<List<Product>>

The List<Product> read from SQLite will have the latest quantity, read using a flow. And I would like this quantity to be reflected to the List<Product> used in the Storefront.

Question

  1. How to I transform the storefront flow to have the latest quantity in accordance with the product and quantity in the cart.
0 Answers
Related