resolveValues method

Future<List<String>> resolveValues(
  1. List<String> values,
  2. NodeId nodeId, {
  3. String? propertyName,
  4. PseudoType? pseudoType,
  5. String? pseudoIdentifier,
})

Resolve the specified values in the context of the provided element. For example, a value of '1em' is evaluated according to the computed 'font-size' of the element and a value 'calc(1px + 2px)' will be resolved to '3px'. If the propertyName was specified the values are resolved as if they were property's declaration. If a value cannot be parsed according to the provided property syntax, the value is parsed using combined syntax as if null propertyName was provided. If the value cannot be resolved even then, return the provided value without any changes. values Substitution functions (var()/env()/attr()) and cascade-dependent keywords (revert/revert-layer) do not work. nodeId Id of the node in whose context the expression is evaluated propertyName Only longhands and custom property names are accepted. pseudoType Pseudo element type, only works for pseudo elements that generate elements in the tree, such as ::before and ::after. pseudoIdentifier Pseudo element custom ident.

Implementation

Future<List<String>> resolveValues(
  List<String> values,
  dom.NodeId nodeId, {
  String? propertyName,
  dom.PseudoType? pseudoType,
  String? pseudoIdentifier,
}) async {
  var result = await _client.send('CSS.resolveValues', {
    'values': [...values],
    'nodeId': nodeId,
    if (propertyName != null) 'propertyName': propertyName,
    if (pseudoType != null) 'pseudoType': pseudoType,
    if (pseudoIdentifier != null) 'pseudoIdentifier': pseudoIdentifier,
  });
  return (result['results'] as List).map((e) => e as String).toList();
}