compareLuminance method Null safety

Color compareLuminance(
  1. Color other,
  2. {bool returnBrighter = true}
)

Exposure method for > operator.

Parameter returnBrighter is true by default, and so this color will be returned if it is brighter than other. If this color is brighter than other and returnBrighter is false, then other is returned instead.

The matter of being "brighter" is determined by the > operator, which compares the colors using computeLuminance.
"This value is computationally expensive to calculate."

Implementation

Color compareLuminance(Color other, {bool returnBrighter = true}) =>
    this > other
        ? returnBrighter
            ? this
            : other
        : returnBrighter
            ? other
            : this;