toString method

  1. @override
String toString ()
override

Returns a string representation of this object.

Implementation

@override
String toString() {
  if (const bool.fromEnvironment('dart.vm.product', defaultValue: false)) {
    return super.toString();
  }
  final StringBuffer result = 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 (imageFilter != null) {
    result.write('${semicolon}imageFilter: $imageFilter');
    semicolon = '; ';
  }
  if (invertColors)
    result.write('${semicolon}invert: $invertColors');
  if (_dither)
    result.write('${semicolon}dither: $_dither');
  result.write(')');
  return result.toString();
}