title: Trying to understand Anonymous Function in Dart
body: <p>I am trying to understand the code which is present in the line </p>
  
  <pre><code>list = (json.decode(response.body) as List)
            .map((data) =&gt; PhotoData.fromJson(data))
            .toList();
  </code></pre>
  
  <p>I have the following questions 
  a) What does .map do ?
  b) What is 'data' in the above code
  c) Could you please simplify the code into long form so that I can better grasp it.</p>
  
  <p>The complete function is listed as below:</p>
  
  <pre><code>_fetchData() async {
  
    http.Response response =
        await http.get("https://jsonplaceholder.typicode.com/photos");
    print("Fetching data...");
    list = (json.decode(response.body) as List)
        .map((data) =&gt; PhotoData.fromJson(data))
        .toList();
    setState(() {
      isLoading =false;
    });
  }
  
  
  
  
  factory PhotoData.fromJson(Map&lt;String, dynamic&gt; json) {
    return PhotoData( json['id'], json['title'],
        json['thumbnailUrl'], json['url']);
  }
  </code></pre>