toString method

  1. @override
String toString ()
override

Returns a string representation of this object.

Implementation

@override
String toString() {
  final StringBuffer result = new StringBuffer();
  String semicolon = '';
  result.write('Paint(');
  if (style == PaintingStyle.stroke) {
    result.write('$style');
    if (strokeWidth != 0.0)
      result.write(' ${strokeWidth.toStringAsFixed(1)}');
    else
      result.write(' hairline');
    if (strokeCap != StrokeCap.butt)
      result.write(' $strokeCap');
    if (strokeJoin == StrokeJoin.miter) {
      if (strokeMiterLimit != _kStrokeMiterLimitDefault)
        result.write(' $strokeJoin up to ${strokeMiterLimit.toStringAsFixed(1)}');
    } else {
      result.write(' $strokeJoin');
    }
    semicolon = '; ';
  }
  if (isAntiAlias != true) {
    result.write('${semicolon}antialias off');
    semicolon = '; ';
  }
  if (color != const Color(_kColorDefault)) {
    if (color != null)
      result.write('$semicolon$color');
    else
      result.write('${semicolon}no color');
    semicolon = '; ';
  }
  if (blendMode.index != _kBlendModeDefault) {
    result.write('$semicolon$blendMode');
    semicolon = '; ';
  }
  if (colorFilter != null) {
    result.write('${semicolon}colorFilter: $colorFilter');
    semicolon = '; ';
  }
  if (maskFilter != null) {
    result.write('${semicolon}maskFilter: $maskFilter');
    semicolon = '; ';
  }
  if (filterQuality != FilterQuality.none) {
    result.write('${semicolon}filterQuality: $filterQuality');
    semicolon = '; ';
  }
  if (shader != null) {
    result.write('${semicolon}shader: $shader');
    semicolon = '; ';
  }
  if (invertColors)
    result.write('${semicolon}invert: $invertColors');
  result.write(')');
  return result.toString();
}