title: make a List from class elements
body: <p>I have a simple question, I have dummy data about some products and I need to take all categories into the new list. How can I do it?</p>
  <pre><code>class Products with ChangeNotifier {
  List&lt;Product&gt; _productItems = [
  Product(
    id: 'p1',
    title: 'Red Shirt',
    price: 29.99,
    category: 'shirts',
  ),
  Product(
    id: 'p2',
    title: 'Trousers',
    description: 'A nice pair of trousers.',
    price: 59.99,
    category: 'Trousers',
  ),
  Product(
    id: 'p3',
    title: 'Yellow Scarf',
    price: 19.99,
    category: 'Scarfs',
  ),
  Product(
    id: 'p4',
    title: 'A Pan',
    price: 49.99,
    category: 'Pans',),];
  
     List&lt;Product&gt; get items {
      return [...items];
     }
  
     List&lt;Product&gt; get fovoriteItems {
     return _productItems.where((prodItem) =&gt; prodItem.isFavorite!).toList();
    }
  
     List&lt;Product&gt; get stockItems {
    return _productItems.where((prodItems) =&gt; prodItems.isStock!).toList();
    }
  
     List&lt;Product&gt; get categoriesList {}
      }
  </code></pre>
  <p>I need to take a <code>List</code> like <code>categories = [Shirts,Trousers,Scarfs,Pans];</code></p>