title: Flutter: Loading local json file returns null
body: <p>Sorry for my very beginner question, I am trying to teach my self Flutter so i am doing some tutorials from youtube and somehow i get <code>Invalid argument(s)</code> error even though i have typed exactly as it is in the tutorial, I tried to debug by printing and first it prints null and then it prints the list with json objects, but when i print <code>mydata[0]</code> it prints <code>The method '[]' was called on null.</code>.</p>
  
  <pre class="lang-dart prettyprint-override"><code>import 'package:flutter/material.dart';
  import 'dart:convert';
  
  void main() {
    runApp(new MaterialApp(
      home: new Home(),
      theme: ThemeData(
        primarySwatch: Colors.indigo,
      ),
    ));
  }
  
  class Home extends StatefulWidget {
    @override
    HomeState createState() =&gt; new HomeState();
  }
  
  class HomeState extends State&lt;Home&gt; {
    List data;
  
    @override
    Widget build(BuildContext context) {
      return new Scaffold(
        appBar: AppBar(
          title: Text("Some App"),
        ),
        body: Container(
          child: Center(
            child: FutureBuilder(
              future: DefaultAssetBundle.of(context).loadString('assets/data.json'),
              builder: (context, snapshot) {
                var mydata = json.decode(snapshot.data.toString());
                print(mydata);
                return ListView.builder(
                  itemBuilder: (BuildContext context, int index) {
                    return Card(
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.stretch,
                        children: &lt;Widget&gt;[
                          Text("Name " + mydata[index]['Name']),
                          Text("Age " + mydata[index]['Age']),
                          Text("Gender " + mydata[index]['Gender']),
                        ],
                      ),
                    );
                  },
                  itemCount: mydata == null ? 0 : mydata.length,
                );
              },
            ),
          ),
        ),
      );
    }
  }
  </code></pre>