title: FLUTTER- FETCH DATA FROM JSON LIST
body: <p>I have some problem that I cannot solve, please help me. I want to fetch data from database, and this data is json list... I wrote some code but I could not print on the console... I will add the code below, please help me... I guess I have to use for loop but when I tried I can just fetch 1 data...</p>
  <p>codes below here:</p>
  <pre><code>class DenemeParca extends StatefulWidget {
    final String parcaReferans;
  
    DenemeParca({this.parcaReferans});
  
    @override
    _DenemeParcaState createState() =&gt; _DenemeParcaState();
  }
  
  Future&lt;List&lt;dynamic&gt;&gt; getIhaleData() async {
    final url =
        'https://www.ekspar.com.tr/onarim/dart.php';
    var response = await http.get(url);
    return json.decode(response.body);
  }
  
  String _parcaReferans(dynamic user) {
    for (var i = 8; i &lt; 40; i++) {
      return user['parca_adi']['$i'];
    }
  }
  
  class _DenemeParcaState extends State&lt;DenemeParca&gt; {
    Widget _buildBody() {
      return FutureBuilder&lt;List&lt;dynamic&gt;&gt;(
        future: getIhaleData(),
        builder: (context, snapshot) {
          return ListView.builder(
            itemCount: snapshot.data.length,
            itemBuilder: (context, index) {
              return Container(
                child: Column(
                  children: &lt;Widget&gt;[
                    RaisedButton(
                      onPressed: () async {
                        print(_parcaReferans(snapshot.data[index]));
                      },
                      child: Text('Get Data'),
                    ),
                  ],
                ),
              );
            },
          );
        },
      );
    }
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        appBar: AppBar(
          title: Text('Title'),
        ),
        body: _buildBody(),
      );
    }
  }
  
  void main() {
    runApp(
      MaterialApp(
        debugShowCheckedModeBanner: false,
        title: 'Ekspar Demo',
        theme: ThemeData(
          backgroundColor: Colors.white,
        ),
        home: DenemeParca() 
      ),
    );
  }
  
  class MyHomePage extends StatefulWidget {
    @override
    _MyHomePageState createState() =&gt; _MyHomePageState();
  }
  
  class _MyHomePageState extends State&lt;MyHomePage&gt; {
    @override
    Widget build(BuildContext context) {
      return DenemeParca();
    }
  }
  </code></pre>
  <p>by the way link has the json codes, thank you...</p>