- override
Stringifies the BoxDecoration. By default, the output will be on one line. If the method is passed a non-empty string argument, then the output will span multiple lines, each prefixed by that argument.
Source
@override
String toString([String prefix = '', String indentPrefix]) {
List<String> result = <String>[];
if (backgroundColor != null)
result.add('${prefix}backgroundColor: $backgroundColor');
if (backgroundImage != null)
result.add('${prefix}backgroundImage: $backgroundImage');
if (border != null)
result.add('${prefix}border: $border');
if (borderRadius != null)
result.add('${prefix}borderRadius: $borderRadius');
if (boxShadow != null) {
if (indentPrefix != null && boxShadow.length > 1) {
result.add('${prefix}boxShadow:');
for (BoxShadow shadow in boxShadow)
result.add('$indentPrefix$shadow');
} else {
result.add('${prefix}boxShadow: ${boxShadow.map((BoxShadow shadow) => shadow.toString()).join(", ")}');
}
}
if (gradient != null)
result.add('${prefix}gradient: $gradient');
if (shape != BoxShape.rectangle)
result.add('${prefix}shape: $shape');
if (prefix == '')
return '$runtimeType(${result.join(', ')})';
if (result.isEmpty)
return '$prefix<no decorations specified>';
return result.join('\n');
}