title: How to parse json in flutter?
body: <p>I want to create a news app and I've used newsapi.org as a source.</p>
  
  <p>I am trying to fetch the JSON data coming by the Http library.</p>
  
  <p>I've provided the entire code below.</p>
  
  <p>It doesn't give me any error but no data loaded and when I print the data it prints everything okay but I can't display it.</p>
  
  <p>I don't what is the problem but all my project has stopped on this problem.</p>
  
  <p>I am looking for a solution for this code because it doesn't work.</p>
  
  <pre class="lang-dart prettyprint-override"><code>import 'dart:convert';
  
  import 'package:flutter/material.dart';
  import 'package:http/http.dart';
  import 'package:newly/services/networking.dart';
  import 'package:newly/widgets/article.dart';
  
  class NewsScreen extends StatefulWidget {
    @override
    _NewsScreenState createState() =&gt; _NewsScreenState();
  }
  
  class _NewsScreenState extends State&lt;NewsScreen&gt; {
  
    List&lt;Article&gt; articles = [];
  
    NetworkHelper networkHelper = NetworkHelper(
      url:
          'https://newsapi.org/v2/everything?q=bitcoin&amp;apiKey=392495172bab4b3885ae93760df54b91',
    );
  
    Future&lt;List&lt;Widget&gt;&gt; getNews() async {
      var newsData = await networkHelper.getData();
  
      for (int i = 0; i &lt; await newsData['articles'].length; i++) {
        var title = await newsData['articles'][i]['title'];
        var urlToImage = await newsData['articles'][i]['urlToImage'];
        var content = await newsData['articles'][i]['content'];
        var author = await newsData['articles'][i]['author'];
        var url = await newsData['articles'][i]['url'];
  
        print(title);
        print(urlToImage);
        print(url);
        print(content);
        print(author);
        print('123456789123456789123456789123456789');
  
        articles.add(
          Article(
            author: author,
            content: content,
            title: title,
            url: url,
            urlToImage: urlToImage,
          ),
        );
  
        print(articles[0].author);
  
      }
  
      return articles;
    }
  
    Future&lt;List&lt;Article&gt;&gt; showArticles() async {
      var data = await get(
        'https://newsapi.org/v2/everything?q=bitcoin&amp;apiKey=392495172bab4b3885ae93760df54b91',
      );
  
      var dataDecoded = await json.decode(data.body);
  
      List&lt;Article&gt; articles = [];
  
      await dataDecoded.forEach(
        (article) {
          articles.add(
            Article(
              author: article['author'],
              content: article['content'],
              title: article['title'],
              url: article['url'],
              urlToImage: article['urlToImage'],
            ),
          );
        },
      );
  
      return articles;
    }
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        appBar: AppBar(
          backgroundColor: Colors.black,
          centerTitle: true,
          title: Text(
            'Newly',
            style: TextStyle(
              color: Colors.white,
            ),
          ),
        ),
        body: FutureBuilder(
          future: getNews(),
          builder: (context, snapshot) {
            return ListView(
              children: articles,
            );
          },
        ),
  
      );
    }
  }
  </code></pre>
  
  <p>Network Helper :</p>
  
  <pre class="lang-dart prettyprint-override"><code>import 'package:http/http.dart' as http;
  import 'dart:convert';
  
  class NetworkHelper {
    NetworkHelper({this.url});
  
    final String url;
  
    Future getData() async {
      http.Response response = await http.get(url);
  
      if (response.statusCode == 200) {
        String data = response.body;
  
        return json.decode(data);
      } else {
        print('something wrong');
        print(response.statusCode);
      }
    }
  }
  </code></pre>