Domanda

How to get the class names of the child elements of the class carousel in dart in the form of an array??

<div class="carousel">
      <div class="galleryCars">
      ....
      </div>
      <div class="galleryCars2">
      ....
      </div>
      <div class="galleryCars3">
      ....
      </div>
      <div class="galleryCars4">
      ....
      </div>
</div>
È stato utile?

Soluzione 2

Quick n dirty:

var carousel = query(".carousel");
var classList = [];
carousel.children.forEach((childElement) => classList.addAll(childElement.classes));
print(classList); // [galleryCars,galleryCars2,galleryCars3,galleryCars4]

Altri suggerimenti

Here's how to get a Set of children class names :

query('.carousel').children.expand((e) => e.classes).toSet();
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top