--

Please be careful on how you collect Flow.

You should not use collect directly in launch. It’s better to use launchWhenStared with job cancellation on destroy or the newest methods: repeatOnLifecycle or flowWithLifecycle.

Flow has a subscription counter and if you don’t cancel the collecting job manually then it will be still in memory : )

--

--

Patryk Kosieradzki
Patryk Kosieradzki

Written by Patryk Kosieradzki

Senior Android &iOS Engineer @ Moss, based in Warsaw, Poland

No responses yet