title: How can I reach a specific data from JSON response in flutter?
body: <p>I am practising flutter and I need to use a data from my response in JSON format. Here is my POST request:</p>
  <pre><code>    final response = await http.post(url,
          headers: {&quot;Content-type&quot;: &quot;application/json&quot;, &quot;accept&quot;: &quot;/&quot;},
          body: json.encode({
            'username': id,
            'password': pwd,
            'deviceId': devid,
          }));
      if (response.statusCode == 200) {
        check = true;
        print(&quot;OK&quot;);
      } else {
        check = false;
        print(&quot;NOT OK&quot;);
      }
      print(response.body);
    }
  </code></pre>
  <p>and my user data class:</p>
  <pre><code>class userData {
    String deviceId;
    String accessToken;
    String name;
    String surname;
  }
  userData globaluserData;
  </code></pre>
  <p>These are two seperate .dart files. So, in my response, I get those datas, but how can I make it like -globaluserData.name = response.name-
  I did some research but to be honest I could not understand and adapt solutions to my project.
  Thanks in advance!</p>