addRule method

Future<CSSRule> addRule(
  1. StyleSheetId styleSheetId,
  2. String ruleText,
  3. SourceRange location
)

Inserts a new rule with the given ruleText in a stylesheet with given styleSheetId, at the position specified by location. styleSheetId The css style sheet identifier where a new rule should be inserted. ruleText The text of a new rule. location Text position of a new rule in the target style sheet. Returns: The newly created rule.

Implementation

Future<CSSRule> addRule(
    StyleSheetId styleSheetId, String ruleText, SourceRange location) async {
  var result = await _client.send('CSS.addRule', {
    'styleSheetId': styleSheetId,
    'ruleText': ruleText,
    'location': location,
  });
  return CSSRule.fromJson(result['rule'] as Map<String, dynamic>);
}