withColor method

Icon withColor(
  1. Color customColor
)

Creates a new Icon with the specified customColor, preserving the icon data.

Example:

Icon originalIcon = Icon(Icons.home);
Icon redIcon = originalIcon.withColor(Colors.red); // Same icon, but red color

Implementation

Icon withColor(Color customColor)
{
  return Icon(icon, color: customColor);
}