className property
String
get
className
Implementation
String get className => _classList.join(_oneSpace);
set
className
(String className)
Implementation
@pragma('vm:prefer-inline')
set className(String className) {
final List<String> classList = className
.split(classNameSplitRegExp)
.where((e) => e.isNotEmpty)
.toList();
final List<String> oldClasses = List.from(_classList);
final Iterable<String> checkKeys = (oldClasses + classList)
.where((key) => !oldClasses.contains(key) || !classList.contains(key));
final bool isNeedRecalculate = _checkRecalculateStyle(List.from(checkKeys));
// Update internal class list
_classList
..clear()
..addAll(classList);
// Maintain document indices for classes when connected
_updateClassIndex(oldClasses, _classList);
// Maintain attribute presence index for [class] selectors.
_updateAttrPresenceIndex(_classNameAttr, present: true);
if (DebugFlags.enableCssBatchRecalc) {
ownerDocument.markElementStyleDirty(this, reason: 'batch:class');
return;
}
recalculateStyle(rebuildNested: isNeedRecalculate);
}