rgba property

Rgba get rgba

Implementation

Rgba get rgba {
  var nextIndex = 0;
  num? a;
  if (_argb.length == 8) {
    // Get alpha blending value 0..255
    var alpha = Color.hexToInt(_argb.substring(nextIndex, nextIndex + 2));
    // Convert to value from 0..1
    a = double.parse((alpha / 255).toStringAsPrecision(2));
    nextIndex += 2;
  }
  var r = Color.hexToInt(_argb.substring(nextIndex, nextIndex + 2));
  nextIndex += 2;
  var g = Color.hexToInt(_argb.substring(nextIndex, nextIndex + 2));
  nextIndex += 2;
  var b = Color.hexToInt(_argb.substring(nextIndex, nextIndex + 2));
  return Rgba(r, g, b, a);
}