hextoRgb static method

String hextoRgb(
  1. String input
)

Converts a hex type String to an RGB type String.

Implementation

static String hextoRgb(String input) {
  String hexColor = input;
  int red = int.parse(hexColor.substring(1, 3), radix: 16);
  int green = int.parse(hexColor.substring(3, 5), radix: 16);
  int blue = int.parse(hexColor.substring(5, 7), radix: 16);

  return "$red,$green,$blue";
}