toCss method
Converts the style to a CSS string.
Implementation
@override
String toCss() {
if (_cssCache != null) return _cssCache!;
final buffer = StringBuffer();
final sortedKeys = _properties.keys.toList()..sort();
if (_minify) {
for (final property in sortedKeys) {
// No indentation, no spaces after colon/semicolon
buffer.write('$property:${_properties[property]};');
}
if (stylesheet != null) {
buffer.write(stylesheet!.toCss());
}
} else {
for (final property in sortedKeys) {
buffer.writeln(' $property: ${_properties[property]};');
}
if (stylesheet != null) {
buffer.write(stylesheet!.toCss());
}
}
_cssCache = buffer.toString();
return _cssCache!;
}