calculateTextForegroundColor property
Color
get
calculateTextForegroundColor
Returns the highest contrast Color (either black or white) based on the relative luminance of the supplied Color
Implementation
Color get calculateTextForegroundColor =>
computeLuminance() > 0.5 ? Colors.black : Colors.white;