cssText property
String
get
cssText
Compiled CSS text for this stylesheet.
Implementation
String get cssText {
final chunks = <String>[];
for (final entry in rules.entries) {
final selector = entry.key;
final rule = entry.value;
if (selector.startsWith('@')) {
final nested = rule.nestedRules.entries
.map((nestedEntry) {
return _compileRule(
_selector(nestedEntry.key),
nestedEntry.value,
);
})
.join('\n');
chunks.add('$selector {\n$nested\n}');
continue;
}
final classSelector = _selector(selector);
chunks.add(_compileRule(classSelector, rule.styles));
_appendState(chunks, classSelector, ':hover', rule.hover);
_appendState(chunks, classSelector, ':focus', rule.focus);
_appendState(chunks, classSelector, ':focus-visible', rule.focusVisible);
_appendState(chunks, classSelector, ':active', rule.active);
_appendState(chunks, classSelector, ':disabled', rule.disabled);
_appendState(chunks, classSelector, ':checked', rule.checked);
_appendState(
chunks,
classSelector,
'[aria-selected="true"]',
rule.selected,
);
_appendState(
chunks,
classSelector,
'[aria-expanded="true"]',
rule.expanded,
);
_appendState(
chunks,
classSelector,
'[aria-invalid="true"]',
rule.invalid,
);
}
return chunks.where((chunk) => chunk.trim().isNotEmpty).join('\n');
}