setStyleTexts method

Future<List<CSSStyle>> setStyleTexts(
  1. List<StyleDeclarationEdit> edits, {
  2. NodeId? nodeForPropertySyntaxValidation,
})

Applies specified style edits one after another in the given order. nodeForPropertySyntaxValidation NodeId for the DOM node in whose context custom property declarations for registered properties should be validated. If omitted, declarations in the new rule text can only be validated statically, which may produce incorrect results if the declaration contains a var() for example. Returns: The resulting styles after modification.

Implementation

Future<List<CSSStyle>> setStyleTexts(List<StyleDeclarationEdit> edits,
    {dom.NodeId? nodeForPropertySyntaxValidation}) async {
  var result = await _client.send('CSS.setStyleTexts', {
    'edits': [...edits],
    if (nodeForPropertySyntaxValidation != null)
      'nodeForPropertySyntaxValidation': nodeForPropertySyntaxValidation,
  });
  return (result['styles'] as List)
      .map((e) => CSSStyle.fromJson(e as Map<String, dynamic>))
      .toList();
}