CSSRuleList extension type

A CSSRuleList represents an ordered collection of read-only CSSRule objects.

While the CSSRuleList object is read-only, and cannot be directly modified, it is considered a live object, as the content can change over time.

To edit the underlying rules returned by CSSRule objects, use CSSStyleSheet.insertRule and CSSStyleSheet.deleteRule, which are methods of CSSStyleSheet.

This interface was an attempt to create an unmodifiable list and only continues to be supported to not break code that's already using it. Modern APIs represent list structures using types based on JavaScript arrays, thus making many array methods available, and at the same time imposing additional semantics on their usage (such as making their items read-only).

These historical reasons do not mean that you as a developer should avoid CSSRuleList. You don't create CSSRuleList objects yourself, but you get them from APIs such as CSSStyleSheet.cssRules and CSSKeyframesRule.cssRules, and these APIs are not deprecated. However, be careful of the semantic differences from a real array.


API documentation sourced from MDN Web Docs.

on
Implemented types
Available extensions

Properties

hashCode int
The hash code for this object.
no setterinherited
length int
The length property of the CSSRuleList interface returns the number of CSSRule objects in the list.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

item(int index) CSSRule?
The item() method of the CSSRuleList interface returns the CSSRule object at the specified index or null if the specified index doesn't exist.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited