insertRule method

int insertRule(
  1. String text,
  2. int index
)

Implementation

int insertRule(String text, int index) {
  final double windowWidth = _document.viewport?.viewportSize.width ?? _document.preloadViewportSize?.width ?? -1;
  final double windowHeight = _document.viewport?.viewportSize.height ?? _document.preloadViewportSize?.height ?? -1;
  final bool isDarkMode = ownerView.rootController.isDarkMode ?? false;

  final int insertedIndex = _sheet.insertRule(
    text,
    index,
    windowWidth: windowWidth,
    windowHeight: windowHeight,
    isDarkMode: isDarkMode,
  );

  cssRules.refresh();
  _scheduleStyleUpdate();
  return insertedIndex;
}