toColor method

Color? toColor()

Implementation

Color? toColor() {
  final hex = this?.replaceAll('#', '') ?? '';

  if (hex.isEmpty || int.tryParse('FF$hex', radix: 16) == null) {
    return null;
  }

  return Color(int.parse('FF$hex', radix: 16));
}