I have a problem with dart equality checks on a Function.
I have a CustomPainter and I want to implement it's shouldRepaint() method efficiently.
There is a Function field (ColorResolver) in the painter that gives a y value and gets a color for drawing on the line, I want this logic to be handled outside of the painter.
check this code:
typedef ColorResolver = Color Function(double value);
class MyPainter extends CustomPainter {
  final ColorResolver colorResolver;
  MyPainter(this.colorResolver);
  @override
  void paint(Canvas canvas, Size size) {
    for (double y = 0; y <= size.height; y += 10) {
      final paint = Paint()..color = colorResolver(y);
      canvas.drawLine(Offset(0, y), Offset(size.width, y), paint);
    }
  }
  @override
  bool shouldRepaint(MyPainter old) => old.colorResolver != colorResolver;
}
How can I prevent repaint as long as the provided ColorResolver logic is the same as before?