title: Get Data from json and put them in TextFields
body: <p>Dears,</p>
  
  <p>I'm new developer in Dart and flutter.. also in mobile applications.</p>
  
  <p>What am doing is i'm getting data from NFC data (encrypted Data like below </p>
  
  <p>"$2y$10$Mo.iv5mePQFyDezZpFhtR.y8HWNlOndhV4gIY//x18XhP1OarCpti"</p>
  
  <p>) and then am sending this encrypting data via an API in order to get the information of the student like below JSON </p>
  
  <pre><code>[{"id":1,"STUDENT_ID":1,"COURSE":"GOL","HASH":"$2y$10$Mo.iv5mePQFyDezZpFhtR.y8HWNlOndhV4gIY\/\/x18XhP1OarCpti","created_at":"2019-09-11 12:24:03","FNAME":"Mohammad","MNAME":"Ahmad","LNAME":"KASSAB","STATE":"Nabatyeh","CITY":"Kafarchuba","NUMBER":82381,"QRCODE":"123456789"}]
  </code></pre>
  
  <p>in my Widget, i have a Text field for each field (FNAME, LNAME...), i need to insert the JSON data in my TextFields.</p>
  
  <p>How to do that please ? </p>
  
  <p>this is my class student.dart</p>
  
  <pre><code>class Student {
    String fname;
    String mname;
    String lname;
    String number;
    String course;
  
    Student(
        {this.fname,
        this.mname,
        this.lname,
        this.number,
        this.course
        });
  
    factory Student.fromJson(json) {
      return Student(
          fname: json["FNAME"],
          mname: json["MNAME"],
          lname: json["LNAME"],
          number: json["NUMBER"],
          course: json["COURSE"]);
    }
  }
  </code></pre>
  
  <p>the main .dart</p>
  
  <pre><code>import 'dart:async';
  import 'dart:convert';
  
  import 'package:flutter/material.dart';
  import 'package:flutter_nfc_reader/flutter_nfc_reader.dart';
  import 'package:http/http.dart' as http;
  import './student.dart' ;
  
  void main() {
    runApp(new MyApp());
  }
  
  class MyApp extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return new MaterialApp(
        title: 'Read NFC',
        home: new MyHomePage(),
      );
    }
  }
  
  class MyHomePage extends StatefulWidget {
    MyHomePage({Key key, this.title}) : super(key: key);
  
    final String title;
  
    final Map&lt;String, dynamic&gt; pluginParameters = {};
  
    @override
    _MyHomePageState createState() =&gt; _MyHomePageState();
  }
  
  class _MyHomePageState extends State&lt;MyHomePage&gt; {
    String s = '';
    var fname = TextEditingController();
    var lname = TextEditingController();
    var mname = TextEditingController();
    var number = TextEditingController();
    var course = TextEditingController();
    List ss = [];
    Future&lt;List&gt; jso;
  
    Future&lt;List&lt;Student&gt;&gt; getData(String hash) async {
      List&lt;Student&gt; list;
      var response = await http.get(
        Uri.encodeFull("http://209.97.178.237/NFC/public/getHash?hash="+hash),
        headers: {
          "Accept": "application/json"
        }
      );
      if (response.statusCode == 200) {
          var data = json.decode(response.body);
          var rest = data as List;
          print(rest);
          list = rest.map&lt;Student&gt;((json) =&gt; Student.fromJson(json)).toList();
        }
         return list;
    }
  
    @override
    Widget build(BuildContext context) {
      return new Scaffold(
        appBar: new AppBar(
          title: const Text('NFC READER'),
        ),
        body: Container(
          margin: EdgeInsets.all(50),
          width: double.infinity,
          child: Column(
            children: &lt;Widget&gt;[
              new Container(
                margin: const EdgeInsets.fromLTRB(10, 10, 10, 40),
                child: new RaisedButton(
                  child: Text("Read NFC"),
                  onPressed: () {
                    FlutterNfcReader.read().then((response) {
                      setState(() {
                        print(response.content);
                        //response.content is the NFC result;
                       // here what to do ? 
                      });
                    });
                  },
                  color: Colors.red,
                  textColor: Colors.white,
                  padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
                  splashColor: Colors.grey,
                ),
              ),
              new Text(
                s,
              ),
              Padding(
                padding: EdgeInsets.only(top: 0, bottom: 25.0, left: 0, right: 0),
                child: TextFormField(
                  decoration: InputDecoration(
                    labelText: 'First Name',
                    fillColor: Colors.white,
                    border: new OutlineInputBorder(
                      borderRadius: new BorderRadius.circular(15.0),
                    ),
                  ),
                  readOnly: true,
                  controller: fname,
                ),
              ),
              Padding(
                padding: EdgeInsets.only(top: 0, bottom: 25.0, left: 0, right: 0),
                child: TextFormField(
                  decoration: InputDecoration(
                    labelText: 'Middle Name',
                    fillColor: Colors.white,
                    border: new OutlineInputBorder(
                      borderRadius: new BorderRadius.circular(15.0),
                    ),
                  ),
                  readOnly: true,
                  controller: fname,
                ),
              ),
              Padding(
                padding: EdgeInsets.only(top: 0, bottom: 25.0, left: 0, right: 0),
                child: TextFormField(
                  decoration: InputDecoration(
                    labelText: 'Last Name',
                    fillColor: Colors.white,
                    border: new OutlineInputBorder(
                      borderRadius: new BorderRadius.circular(15.0),
                    ),
                  ),
                  readOnly: true,
                  controller: fname,
                ),
              ),
              Padding(
                padding: EdgeInsets.only(top: 0, bottom: 25.0, left: 0, right: 0),
                child: TextFormField(
                  decoration: InputDecoration(
                    labelText: 'Number',
                    fillColor: Colors.white,
                    border: new OutlineInputBorder(
                      borderRadius: new BorderRadius.circular(15.0),
                    ),
                  ),
                  readOnly: true,
                  controller: fname,
                ),
              ),
              Padding(
                padding: EdgeInsets.only(top: 0, bottom: 25.0, left: 0, right: 0),
                child: TextFormField(
                  decoration: InputDecoration(
                    labelText: 'Course',
                    fillColor: Colors.white,
                    border: new OutlineInputBorder(
                      borderRadius: new BorderRadius.circular(15.0),
                    ),
                  ),
                  readOnly: true,
                  controller: fname,
                ),
              ),
            ],
          ),
        ),
      );
    }
  }
  
  </code></pre>
  
  <p>thank you.</p>