So, last year, Flutter switched from simple representation of color using a 32-bit int (e.g. 0xFF006611) to something much more involved. This was done in order to support wide gamut colors, AFAIK.
Since then, Color is no longer a tiny box over an integer, but it’s 4 doubles and a color space. Still, it’s of course possible to convert the color back to a 32-bit integer. Implicitly, this is done when you access Color.value, and explicitly, you can call the toARGB32() method.
Back in December 2024, folks (including me) asked if it would be possible to have some kind of “8bit color” back, but understandably, this was not going to fly.
Anyway, if you’re only doing a few Color operations per frame, it’s fine, of course. But I have a case in my game where I construct a color, then do operations on it (Color has a nice API for things like making a color brighter), and then feed it to a Canvas.drawVertices() call thousands of times per frame.
I therefore knew the change will have some performance implication for me if I just use Color.value, but I didn’t measure it. The game performs okay.
Today, I measured, and found out that Color.value took something like 10% of my game’s CPU time. That’s… significant.
By removing Color and just going with a simple integer, plus some basic manipulation of it, I was able to remove this overhead altogether.
I know my case is niche but I thought I’d share nevertheless.
P.S.: Color.value is deprecated, and has been for months (you should use the more explicit Color.toARBG32(), which is more explicit about doing some work). So it’s unlikely people who use Color.value are completely unaware of this issue. But maybe, like me, they let themselves sleep on it.