title: How Can I access JSON Object using flutter?
body: <p>How Can I access my JSON Objects? </p>
  
  <p>Getting <code>Employee Title = null</code> How can I directly use the object?</p>
  
  <p>Like this Getting proper output <code>Text('Employee Title = ${list[0].title}')</code> or any other way directly using model object ?</p>
  
  <p>What is the correct way?</p>
  
  <pre><code>import 'dart:convert';
  import 'package:flutter/material.dart';
  import 'package:http/http.dart' as http;
  import 'package:flutter/cupertino.dart';
  
  
  class EmployeeModel {
    int userId;
    int id;
    String title;
    String body;
  
    EmployeeModel({this.userId, this.id, this.title, this.body});
  
    EmployeeModel.fromJson(Map&lt;String, dynamic&gt; json) {
      userId = json['userId'];
      id = json['id'];
      title = json['title'];
      body = json['body'];
    }
  }
  class EmployeePage extends StatefulWidget {
    @override
    State&lt;StatefulWidget&gt; createState() {
      // TODO: implement createState
      return EmployeePageState();
    }
  }
  
  class EmployeePageState extends State&lt;EmployeePage&gt; {
    EmployeeModel model = EmployeeModel();
    List&lt;EmployeeModel&gt; list = List();
    var isLoading = false;
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
          appBar: AppBar(
            title: Text('Employee Title = ${model.title}'),
          ),
          body: isLoading
              ? Center(
            child: CircularProgressIndicator(),
          ):Center(
              child: Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: &lt;Widget&gt;[
  
                  ])));
    }
  
  
    @override
    void initState() {
      super.initState();
      getEmployee(2);
    }
  
    getEmployee(int id) async {
      setState(() {
        isLoading = true;
      });
      final response =
          await http.get("https://jsonplaceholder.typicode.com/posts?userId=$id");
      if (response.statusCode == 200) {
        list = (json.decode(response.body) as List)
            .map((data) =&gt; new EmployeeModel.fromJson(data))
            .toList();
        setState(() {
          isLoading = false;
        });
      }
    }
  }
  </code></pre>
  
  <p>My Code is working fine but I want to know is this right way?
  This way<br>
  <code>Text('Employee Title = ${list[0].title}')</code>
  or if I want to directly use object what is the way?</p>
  
  <p>My Code is working fine but I want to know is this right way?
  This way<br>
  Text('Employee Title = ${list[0].title}')
  or if I want to directly use object what is the way?</p>