Should selector add a method shouldUpdate that we can control ourselves, and if we don't implement it we'll still implement selected! = value, so we can control the List refresh, as follows:
@override
Widget build(BuildContext context) {
final selected = widget.selector(context);
if (oldWidget != widget || shouldUpdate!=null ? shouldUpdate(selected,value) : selected != value ) {
value = selected;
oldWidget = widget;
cache = widget.builder(
context,
selected,
widget.child,
);
}
return cache;
}
Selector < A, List<B> > (
selector (_, A) = > a. list,
builder: (_) = > SizedBox (),
shouldUpdate: (newList, oldList) = > newList! = oldList || newList. length! = oldList. Length
)
Originally posted by @2534290808 in #205 (comment)
Should selector add a method shouldUpdate that we can control ourselves, and if we don't implement it we'll still implement
selected! = value, so we can control the List refresh, as follows:Originally posted by @2534290808 in #205 (comment)