Flutter MVVM Passing view model as parameter between screens instead of passing models or variables

Viewed 277

I was just looking through one of my staffs code and I noticed he passed the actual view model to a new screen instead of just passing a variable parameter like below:

final LoginScreenViewModel model;

 const OtpScreen({Key? key, required this.model}) : super(key: key);

These are actually all views on the login screen but it is a new screen. I remember back when I was doing Android Native that avoiding passing context around to avoid memory leaks. I am wondering whether this would be a similar scenario?

Thanks

0 Answers
Related