Don't disable toString in release mode for dart:ui classes (flutter/engine#12204)

This commit is contained in:
Harry Terkelsen 2019-09-11 10:26:15 -07:00 committed by GitHub
parent f8269d15a0
commit 21f124118f
2 changed files with 28 additions and 41 deletions

View File

@ -275,11 +275,7 @@ class Color {
@override
String toString() {
if (engine.assertionsEnabled) {
return 'Color(0x${value.toRadixString(16).padLeft(8, '0')})';
} else {
return super.toString();
}
return 'Color(0x${value.toRadixString(16).padLeft(8, '0')})';
}
}
@ -1192,36 +1188,32 @@ class Paint {
@override
String toString() {
if (engine.assertionsEnabled) {
final StringBuffer result = StringBuffer();
String semicolon = '';
result.write('Paint(');
if (style == PaintingStyle.stroke) {
result.write('$style');
if (strokeWidth != null && strokeWidth != 0.0)
result.write(' $strokeWidth');
else
result.write(' hairline');
if (strokeCap != null && strokeCap != StrokeCap.butt)
result.write(' $strokeCap');
semicolon = '; ';
}
if (isAntiAlias != true) {
result.write('${semicolon}antialias off');
semicolon = '; ';
}
if (color != _defaultPaintColor) {
if (color != null)
result.write('$semicolon$color');
else
result.write('${semicolon}no color');
semicolon = '; ';
}
result.write(')');
return result.toString();
} else {
return super.toString();
final StringBuffer result = StringBuffer();
String semicolon = '';
result.write('Paint(');
if (style == PaintingStyle.stroke) {
result.write('$style');
if (strokeWidth != null && strokeWidth != 0.0)
result.write(' $strokeWidth');
else
result.write(' hairline');
if (strokeCap != null && strokeCap != StrokeCap.butt)
result.write(' $strokeCap');
semicolon = '; ';
}
if (isAntiAlias != true) {
result.write('${semicolon}antialias off');
semicolon = '; ';
}
if (color != _defaultPaintColor) {
if (color != null)
result.write('$semicolon$color');
else
result.write('${semicolon}no color');
semicolon = '; ';
}
result.write(')');
return result.toString();
}
}
@ -1447,9 +1439,7 @@ class ColorFilter {
}
@override
String toString() => engine.assertionsEnabled
? 'ColorFilter($_color, $_blendMode)'
: super.toString();
String toString() => 'ColorFilter($_color, $_blendMode)';
}
/// Styles to use for blurs in [MaskFilter] objects.

View File

@ -793,10 +793,7 @@ class TextBox {
@override
String toString() {
if (engine.assertionsEnabled) {
return 'TextBox.fromLTRBD(${left.toStringAsFixed(1)}, ${top.toStringAsFixed(1)}, ${right.toStringAsFixed(1)}, ${bottom.toStringAsFixed(1)}, $direction)';
}
return super.toString();
return 'TextBox.fromLTRBD(${left.toStringAsFixed(1)}, ${top.toStringAsFixed(1)}, ${right.toStringAsFixed(1)}, ${bottom.toStringAsFixed(1)}, $direction)';
}
}