title: Flutter: Filter list as per some condition
body: <p>I'm having a list of Movies. That contains all Animated &amp; non Animated Movies. To identify whether it's Animated or not there is one flag called <strong>isAnimated</strong>.</p>
  <p>I want to show only Animated movies. I have written code to filter out only Animated movies but getting some error.</p>
  <pre><code>import 'package:flutter/material.dart';
  
  void main() =&gt; runApp(new MyApp());
  
  class MyApp extends StatelessWidget {
    // This widget is the root of your application.
    @override
    Widget build(BuildContext context) {
      return new MaterialApp(
        title: 'Flutter Demo',
        theme: new ThemeData(
  
          primarySwatch: Colors.blue,
        ),
        home: new HomePage(),
      );
    }
  }
  
  class Movie {
    Movie({this.movieName, this.isAnimated, this.rating});
    final String movieName;
    final bool isAnimated;
    final double rating;
  }
  
  List&lt;Movie&gt; AllMovies = [
    new Movie(movieName: &quot;Toy Story&quot;,isAnimated: true,rating: 4.0),
    new Movie(movieName: &quot;How to Train Your Dragon&quot;,isAnimated: true,rating: 4.0),
    new Movie(movieName: &quot;Hate Story&quot;,isAnimated: false,rating: 1.0),
    new Movie(movieName: &quot;Minions&quot;,isAnimated: true,rating: 4.0),
  ];
  
  
  
  class HomePage extends StatefulWidget{
    @override
    _homePageState createState() =&gt; new _homePageState();
  }
  
  
  class _homePageState extends State&lt;HomePage&gt; {
  
    List&lt;Movie&gt; _AnimatedMovies = null;
  
    @override
    void initState() {
      super.initState();
      _AnimatedMovies = AllMovies.where((i) =&gt; i.isAnimated);
    }
  
    @override
    Widget build(BuildContext context) {
      return new Scaffold(
        body: new Container(
          child: new Text(
              &quot;All Animated Movies here&quot;
          ),
        ),
      );
    }
  }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/MTiQ8.png" rel="noreferrer"><img src="https://i.stack.imgur.com/MTiQ8.png" alt="WhereIterable is not subtype of type List" /></a></p>