fromARGBHexString static method

Paint fromARGBHexString(
  1. String hexString
)

Parses an ARGB color from a valid hex string (e.g. #1C1C1C).

The # is optional. The short-hand syntax is support, e.g.: #CCCC. Lower-case letters are supported.

Examples of valid inputs: fccc, FCCC, #fccc, #FCCC, #ffc1c1c1, #FFC1C1C1, ffc1c1c1, FFC1C1C1

If the string is not valid, an error is thrown.

Note: if you are hardcoding colors, use Dart's built-in hexadecimal literals instead.

Implementation

static Paint fromARGBHexString(String hexString) {
  final color = ColorExtension.fromARGBHexString(hexString);
  return Paint()..color = color;
}