How to use hexadecimal color string in Flutter?

All the developers will be quite familiar with the hexadecimal format for representing color. A hexadecimal color is specified with #RRGGBB. In flutter, color is defined using Color class. The color class accepts an immutable 32-bit color value in ARGB format.

For example, coral color with a Hex triplet #FF7F50 can be defined in Flutter using a 32-bit color value in ARGB format as the example below. You just need to prefix it with 0XFF.

You can also use named constructors like fromARGB, fromRGBO to define the color like the example shown below:

If you need to use dynamic values of hexadecimal color, you can also define a custom class that extends Color class as shown below.