title: flutter loop inside a widget
body: <p>I'm new to flutter and was wondering if anyone would be able to guide me.</p>
  
  <p>I would like to irritate through a string that I retrieved from a json file. I would like to display each letter separately. Example below.</p>
  
  <p><strong>Output</strong>
  Complete Word: Hi
  Letter pos 0: H
  Letter pos 1:  I</p>
  
  <p>What I tried so far is adding a for loop below the itemBuilder but can't retrieve the variable inside the card. I tried adding a for loop inside the Widget and it doesn't allow me. </p>
  
  <p>Any input would be greatly appreciated!</p>
  
  <pre><code>import 'dart:convert';
  
  import 'package:flutter/material.dart';
  
  
  void main() {
    runApp(new MaterialApp(
      home: new MyApp(),
    ));
  }
  
  class MyApp extends StatefulWidget {
    @override
    MyAppState createState() =&gt; new MyAppState();
  }
  
  class MyAppState extends State&lt;MyApp&gt; {
    List data;
  
    @override
    Widget build(BuildContext context) {
      return new Scaffold(
          appBar: new AppBar(
            title: new Text("Load local JSON file"),
          ),
          body: new Container(
            child: new Center(
              // Use future builder and DefaultAssetBundle to load the local JSON file
              child: new FutureBuilder(
                  future: DefaultAssetBundle
                      .of(context)
                      .loadString('data_repo/starwars_data.json'),
                  builder: (context, snapshot) {
                    // Decode the JSON
                    var new_data = JSON.decode(snapshot.data.toString());
  
                    return new ListView.builder(
                      // Build the ListView
  
                      itemBuilder: (BuildContext context, int index) { 
                        return new Card(
                          child: new Column(
                            crossAxisAlignment: CrossAxisAlignment.stretch,
                            children: &lt;Widget&gt;[
                              new Text("Complete Word: " + new_data[index]['complete_word'])
                            ],
                          ),
                        );
                      },
                      itemCount: new_data == null ? 0 : new_data.length,
                    );
                  }),
            ),
          ));
    }
  }
  </code></pre>