-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
This is more of a question as I am still learning, but I see that we are using the Provider for DI which is great. However, I see in some places like here:
class HomeHeader extends StatelessWidget
that we do this:
LogoutButton(
viewModel: LogoutViewModel(
authRepository: context.read(),
itineraryConfigRepository: context.read(),
),
),
We are creating a new LogoutViewModel
instead of using a singleton like the one used with the Provider.
Isn't this view model going to lose its' state across widget rebuilds? Shouldn't there be strictly one ViewModel of the same type existing in the app context?
samples/compass_app/app/lib/ui/home/widgets/home_title.dart
Lines 40 to 45 in 5a7decd
LogoutButton( | |
viewModel: LogoutViewModel( | |
authRepository: context.read(), | |
itineraryConfigRepository: context.read(), | |
), | |
), |
morismoze
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working