Ad

Which Is More Expensive Provider Vs Setstate?

Is it a good practice to use provider in place of setstate talking for MVVM architecture and in general also? Does provider rebuilds the whole app widget tree like if i trigger it in second page than will 1st page also be rebuilt, if so then how can we use it more effectevly?

Ad

Answer

Provider state management offer Consumer. That Consumer has a build function itself. So you can use consumer in which widget you want to rebuild. You don't need to rebuild the whole widget tree. Consumer will listen your provider method and it will rebuild a specific widget where you want to change. Thanks

Ad
source: stackoverflow.com
Ad