Problem:
It is too easy to forget to specify listen: false on a click handler / ...
This causes undesired effects, where after an event handler, the handler widget suddenly rebuilds too often.
Solution:
Since event handlers are always called when the widget tree isn't building, we can automatically infer what listen should be
Consequence:
RaisedButton(
onPressed: () {
Provider.of<Whatever>(context);
}
)
^ This code will now break.
Before, it caused the widget that creates RaisedButton to rebuild when Whatever changes.
Now, no rebuild will be caused.
For production code, this is usually not an issue.
Where this has an impact, on the other hand, is for tests.
If you previously called Provider.of after a tester.pumpWidgets to test if something was rebuilding, then your test may now fail.
Problem:
It is too easy to forget to specify
listen: falseon a click handler / ...This causes undesired effects, where after an event handler, the handler widget suddenly rebuilds too often.
Solution:
Since event handlers are always called when the widget tree isn't building, we can automatically infer what
listenshould beConsequence:
^ This code will now break.
Before, it caused the widget that creates
RaisedButtonto rebuild whenWhateverchanges.Now, no rebuild will be caused.
For production code, this is usually not an issue.
Where this has an impact, on the other hand, is for tests.
If you previously called
Provider.ofafter atester.pumpWidgetsto test if something was rebuilding, then your test may now fail.