Search code examples
flutterflutter-provider

Provider vs. InheritedWidget


Am I wrong or if we just want to pass a value down the Widget tree, Provider is just an InheritedWidget with a dispose method?


Solution

  • Yes. Provider is indeed mostly features based on Inheritedwidgets.

    If you want to make your own, then that's fine. But you'll quickly realize that, without provider, you'll have hundreds of useless repetitive lines.

    Provider basically takes the logic of InheritedWidgets, but reduce the boilerplate to the strict minimum.