--

Hi Colvin, the prime objective of passing that as a constructor parameter is to have inversion of control so that at the time of initialization of viewmodel you also specify about the repo/s that this particular viewmodel is going to access. There is no hard rule for such things you may even create the repo object inside viewmodel too.

--

--

Pankaj Rai 🇮🇳
Pankaj Rai 🇮🇳

Written by Pankaj Rai 🇮🇳

Software Engineer | GDE Android & Firebase | YouTuber — All Techies

Responses (1)