title: Unhandled Exception: type 'String' is not a subtype of type 'int' of 'index' flutter new
body: <p>I am not getting output on my app and it should have give a output like many question is how to sisplay json data in my flutter app</p>
  
  <pre><code>class AppState extends State&lt;AppName&gt;{
     var name ;
     var email ;
     int cgpa ;
     TextEditingController user = new TextEditingController();
     String url = 'http://10.42.0.243:8000/students/';
  
  getData(String username) async{
  String profile = url+'?search='+username;
  var res = await http.get(profile,headers: {"Accept":"application/json"});
  print(res.body);
  debugPrint(res.body);
  var resBody = json.decode(res.body);
  name = resBody['sname'].toString();
  email = resBody['email'].toString();
  cgpa = resBody['cgpa']  ;
  debugPrint(name);
  setState(() {
    print("Success");
  
   });
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/NZ5Qt.jpg" rel="nofollow noreferrer">my app screenshot is</a></p>
  
  <p><a href="https://i.stack.imgur.com/PHioT.jpg" rel="nofollow noreferrer">JSON Data Screenshot</a></p>
  
  <p>Error output:
  Performing hot reload...
  Syncing files to device Moto G 5 Plus...
  Reloaded 0 of 576 libraries in 389ms.
  E/BpSurfaceComposerClient(28411): Failed to transact (-1)
  E/BpSurfaceComposerClient(28411): Failed to transact (-1)
  I/flutter (28411): [{"id":1,"sname":"Ashutosh Lokhande","email":"2016bit053@sggs.ac.in","year":"2016","cgpa":7.2}]
  I/flutter (28411): [{"id":1,"sname":"Ashutosh Lokhande","email":"2016bit053@sggs.ac.in","year":"2016","cgpa":7.2}]
  E/flutter (28411): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: type 'String' is not a subtype of type 'int' of 'index'
  E/flutter (28411): #0      AppState.getData (package:json_flutter/main.dart:28:19)
  E/flutter (28411): 
  E/flutter (28411): #1      AppState.build. (package:json_flutter/main.dart:56:34)
  E/flutter (28411): #2      _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:654:14)
  E/flutter (28411): #3      _InkResponseState.build. (package:flutter/src/material/ink_well.dart:729:32)
  E/flutter (28411): #4      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24)
  E/flutter (28411): #5      TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:365:11)
  E/flutter (28411): #6      TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:275:7)
  E/flutter (28411): #7      PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:455:9)
  E/flutter (28411): #8      PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:75:13)
  E/flutter (28411): #9      PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:102:11)
  E/flutter (28411): #10     GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:218:19)
  E/flutter (28411): #11     GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:198:22)
  E/flutter (28411): #12     GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:156:7)
  E/flutter (28411): #13     GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:102:7)
  E/flutter (28411): #14     GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:86:7)
  E/flutter (28411): #15     _rootRunUnary (dart:async/zone.dart:1136:13)
  E/flutter (28411): #16     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
  E/flutter (28411): #17     _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
  E/flutter (28411): #18     _invoke1 (dart:ui/hooks.dart:263:10)
  E/flutter (28411): #19     _dispatchPointerDataPacket (dart:ui/hooks.dart:172:5)
  E/flutter (28411): </p>