insertRule method

dynamic insertRule(
  1. String text,
  2. int index, {
  3. required double windowWidth,
  4. required double windowHeight,
  5. required bool isDarkMode,
})

Implementation

insertRule(String text, int index, {required double windowWidth, required double windowHeight, required bool isDarkMode}) {
  // Parse with this stylesheet's href so relative URLs in inserted rules
  // resolve against the stylesheet URL, not the document URL.
  List<CSSRule> rules = CSSParser(text, href: href)
      .parseRules(windowWidth: windowWidth, windowHeight: windowHeight, isDarkMode: isDarkMode);
  cssRules.addAll(rules);
}