parseHex static method

Color parseHex(
  1. String value
)

Parses a hexadecimal color string into a Color.

This method converts a string representing a hexadecimal color (e.g., #RRGGBB) into a Color object. The string must start with # and contain six hexadecimal digits.

Parameters

  • value: The hexadecimal color string to parse.

Returns

A Color corresponding to the given hexadecimal string.

Example

final color = ColorUtils.parseHex("#3498DB"); // Converts to Color(0xFF3498DB).

Implementation

static Color parseHex(String value) =>
    Color(int.parse(value.substring(1, 7), radix: 16) + 0xFF000000);