5

Learning more about the Provider and ChangeNotifier architecture, I find it really similar to the old good MVVM architecture, where a Widget is the View and gets notified for changes by the ViewModel, which is the ChangeNotifier, linked by a Consumer and a Provider.

Why isn't this called MVVM for Flutter then? Are there any actual differences between those two architectures?

Michel Feinstein
  • 13,416
  • 16
  • 91
  • 173

2 Answers2

8

Provider is not a State-Management library, it's Dependency-Injection.

With Provider you can implement almost any type of state-management solution and it makes things much easier for you.

You may heard of BLoC, in Flutter it's suggested architecture and people nowadays usually prefer BLoC(Architecture) with Provider(DI).

BLoC architecture is very similar to MVVM, the difference is BLoC is more responsive/modern, also it's suits Flutter's reactive/functional structure better. But basically, it's arguably same if you are not big fan of events-state mechanism. So yes, your observation is true, we usually use evolved-MVVM fundamentally.

Mehmet Esen
  • 6,156
  • 3
  • 25
  • 44
7

provider is by no mean an architecture. It's an ingredient.

There's absolutely nothing forcing you to use ChangeNotifier when using Provider.

You can use it in combination with other things, including Mobx, BLoC, Redux, ...

Rémi Rousselet
  • 256,336
  • 79
  • 519
  • 432