android / play-billing-samples

Samples for Google Play In-app Billing
Apache License 2.0
2.37k stars 1.33k forks source link

Replace LiveData in Repository? #385

Open johngoren opened 3 years ago

johngoren commented 3 years ago

Thanks for the wonderfully well-documented code sample. Just one thing: Word on the street is that we're not supposed to be using LiveData in Repositories anymore. Wonder what the Billing Repo would look like without it? Would we use Flow or something?

calren commented 3 years ago

That is correct that we don't recommend using LiveData in the Repository anymore! We are currently working on more guidance and samples around what this means in terms of alternative approaches.

DAGalpin commented 3 years ago

The TrivialDriveKotlin sample now uses Flow through the repository layer and then switches back to LiveData in the ViewModel using the asLiveData() extension.