using provider : selector with list in flutter

Viewed 239

My question is about using provider in flutter, now I have a list of 100 items and in every time I get any update, the provider replace the whole list. So, my question is how to use provider in a list without needing to re-rendering the whole list items?!!

1 Answers

see Consumer/Selector at https://pub.dev/packages/provider

Foo(
  child: Consumer<A>(
    builder: (_, a, child) {
      return Bar(a: a, child: child);
    },
    child: Baz(),
  ),
)

In this example, only Bar will rebuild when A updates. Foo and Baz won't unnecessarily rebuild.

Related