title: 'String' not subtype of 'int' flutter
body: <p>this is my first flutter JSON example, I tried to fetch data from the json link and display the titles as list view</p>
  
  <p>I used this <a href="https://github.com/tensor-programming/Flutter_calling_api/blob/master/lib/main.dart" rel="noreferrer">code</a> to write mine with some changes .. in the link he has <code>results</code> array in mine I haven't so I left the <code>data = resBody[" "];</code>
  empty is that right?</p>
  
  <p>also, I got this error with the flutter HTTP request and don't really what to do </p>
  
  <p>any help, please? </p>
  
  <pre><code>Dart Error: Unhandled exception:
   type 'String' is not a subtype of type 'int' of 'index'
  </code></pre>
  
  <p>this is my code </p>
  
  <pre><code> import 'package:flutter/material.dart';
      import 'dart:async';
      import 'dart:convert';
      import 'package:http/http.dart' as http;
  
      void main() {
        runApp(MaterialApp(
      home: ToDo(),
    ));
  }
  
  class ToDo extends StatefulWidget {
    @override
    ToDoState createState() =&gt; ToDoState();
  }
  
  class ToDoState extends State&lt;ToDo&gt; {
    final String url = "https://jsonplaceholder.typicode.com/todos";
    List data;
  
    Future&lt;String&gt; getTitle() async {
      var res = await http
          .get(Uri.encodeFull(url), headers: {"Accept": "application/json"});
  
      setState(() {
        var resBody = json.decode(res.body);
        data = resBody[" "];
      });
  
      return "Success!";
    }
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        appBar: AppBar(
          title: Text("Title List"),
          backgroundColor: Colors.amber,
        ),
        body: ListView.builder(
          itemCount: data == null ? 0 : data.length,
          itemBuilder: (BuildContext context, int index) {
            return new Container(
              child: Center(
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.stretch,
                  children: &lt;Widget&gt;[
                    Card(
                      child: Container(
                          padding: EdgeInsets.all(15.0),
                          child: Row(
                            children: &lt;Widget&gt;[
                              Text("Title: "),
                              Text(data[index]["title"],
                                  style: TextStyle(
                                      fontSize: 18.0, color: Colors.black87)),
                            ],
                          )),
                    ),
                  ],
                ),
              ),
            );
          },
        ),
      );
    }
  
    @override
    void initState() {
      super.initState();
      this.getTitle();
    }
  }
  </code></pre>