When to use Provider.of vs. Consumer in Flutter

前端 未结 4 593
一整个雨季
一整个雨季 2020-12-08 19:42

I\'m still wrapping my head around state-management techniques in flutter and am a bit confused about when and why to use Provider.of vs. Consume

4条回答
  •  佛祖请我去吃肉
    2020-12-08 20:08

    The widget Consumer doesn't do any fancy work. It just calls Provider.of in a new widget, and delegate its build implementation to [builder]. It's just syntactic sugar for Provider.of but the funny thing is I think Provider.of is simpler to use.

    Look at this article for more clearance https://blog.codemagic.io/flutter-tutorial-provider/

提交回复
热议问题