decorateRootNodeWithPlatformClasses function
void
decorateRootNodeWithPlatformClasses({
- List<
Feature> features = const [], - bool includeDefaults = true,
- Element? rootNode,
- VoidCallback? callback,
Appends CSS classes generated by getPlatformClasses to the specified rootNode
.
If you do not want defaultFeatureCssClassDecorators to be used,
set includeDefaults
to false
.
By default, rootNode
is document.documentElement
.
Implementation
void decorateRootNodeWithPlatformClasses(
{List<Feature> features = const [],
bool includeDefaults = true,
Element? rootNode,
VoidCallback? callback}) {
rootNode ??= document.documentElement;
if (rootNode != null && !nodeHasBeenDecorated(rootNode)) {
var existingClasses = rootNode.classes.toList();
rootNode.className = getPlatformClasses(
features: features,
includeDefaults: includeDefaults,
existingClasses: existingClasses);
callback?.call();
}
}