Avoid overriding operator == on Widget objects.
While it may seem like it would help by avoiding unnecessary rebuilds,
in practice it hurts performance because it results in O(N²) behavior.
The only exception to this rule is leaf widgets (widgets with no children),
in the specific case where comparing the properties of the widget
is likely to be significantly more efficient than rebuilding the widget
and where the widget will rarely change configuration.
Even in such cases,
it is generally preferable to rely on caching the widgets,
because even one override of operator ==
can result in across-the-board performance degradation
as the compiler can no longer assume that the call is always static.

Resources

For more performance info, check out the following resources:

Performance optimizations in the AnimatedBuilder API page

Performance considerations for opacity animation
in the Opacity API page

Child elements’ lifecycle and how to load them efficiently,
in the ListView API page

Performance considerations of a StatefulWidget