replaceSync method

dynamic replaceSync(
  1. String text, {
  2. required double windowWidth,
  3. required double windowHeight,
  4. required bool? isDarkMode,
})

Synchronously replaces the content of the stylesheet with the content passed into it.

Implementation

replaceSync(String text, {required double windowWidth, required double windowHeight, required bool? isDarkMode}) {
  cssRules.clear();
  // Preserve href so relative URLs continue to resolve correctly after replace.
  List<CSSRule> rules = CSSParser(text, href: href)
      .parseRules(windowWidth: windowWidth, windowHeight: windowHeight, isDarkMode: isDarkMode);
  cssRules.addAll(rules);
}