title: getting data from a list flutter
body: <p>i want to get data from a list its working with the first 6 attributes but i wanted to add the  &quot;description&quot;, &quot;assetsideid&quot;, &quot;assetnum&quot;, &quot;location&quot; and &quot;descriptionlongdescription&quot;
  but it stopped showing data and i keep getting these errors (i got the code from a online json to dart)
  i get the error from the  description till descriptionLongdescription
  &quot;The argument type 'Affecteddate?' can't be assigned to the parameter type 'Affecteddate'&quot;
  and thank you</p>
  <pre><code>
  import 'dart:convert';
  
  Demandes azizFromJson(String str) =&gt; Demandes.fromJson(json.decode(str));
  
  String azizToJson(Demandes data) =&gt; json.encode(data.toJson());
  
  class Demandes {
    Demandes({
      required this.srMboSet,
    });
  
    SrMboSet srMboSet;
  
    factory Demandes.fromJson(Map&lt;String, dynamic&gt; json) =&gt; Demandes(
          srMboSet: SrMboSet.fromJson(json[&quot;SRMboSet&quot;]),
        );
  
    Map&lt;String, dynamic&gt; toJson() =&gt; {
          &quot;SRMboSet&quot;: srMboSet.toJson(),
        };
  }
  
  class SrMboSet {
    SrMboSet({
      required this.rsStart,
      required this.rsCount,
      required this.sr,
    });
  
    int rsStart;
    int rsCount;
    List&lt;Sr&gt; sr;
  
    factory SrMboSet.fromJson(Map&lt;String, dynamic&gt; json) =&gt; SrMboSet(
          rsStart: json[&quot;rsStart&quot;],
          rsCount: json[&quot;rsCount&quot;],
          sr: List&lt;Sr&gt;.from(json[&quot;SR&quot;].map((x) =&gt; Sr.fromJson(x))),
        );
  
    Map&lt;String, dynamic&gt; toJson() =&gt; {
          &quot;rsStart&quot;: rsStart,
          &quot;rsCount&quot;: rsCount,
          &quot;SR&quot;: List&lt;dynamic&gt;.from(sr.map((x) =&gt; x.toJson())),
        };
  }
  
  class Sr {
    Sr({
      required this.rowstamp,
      required this.attributes,
    });
  
    String rowstamp;
    Attributes attributes;
  
    factory Sr.fromJson(Map&lt;String, dynamic&gt; json) =&gt; Sr(
          rowstamp: json[&quot;rowstamp&quot;],
          attributes: Attributes.fromJson(json[&quot;Attributes&quot;]),
        );
  
    Map&lt;String, dynamic&gt; toJson() =&gt; {
          &quot;rowstamp&quot;: rowstamp,
          &quot;Attributes&quot;: attributes.toJson(),
        };
  }
  
  class Attributes {
    Attributes({
      required this.ticketid,
      required this.attributesClass,
      required this.status,
      required this.statusdate,
      required this.reportedby,
      required this.description,
      required this.assetsiteid,
      required this.assetnum,
      required this.location,
      required this.descriptionLongdescription,
    });
  
    Affecteddate ticketid;
    Affecteddate attributesClass;
    Affecteddate status;
    Affecteddate statusdate;
    Affecteddate reportedby;
    Affecteddate description;
    Affecteddate assetsiteid;
    Affecteddate assetnum;
    Affecteddate location;
    Affecteddate descriptionLongdescription;
  
    factory Attributes.fromJson(Map&lt;String, dynamic&gt; json) =&gt; Attributes(
          ticketid: Affecteddate.fromJson(json[&quot;TICKETID&quot;]),
          attributesClass: Affecteddate.fromJson(json[&quot;CLASS&quot;]),
          status: Affecteddate.fromJson(json[&quot;STATUS&quot;]),
          statusdate: Affecteddate.fromJson(json[&quot;STATUSDATE&quot;]),
          reportedby: Affecteddate.fromJson(json[&quot;REPORTEDBY&quot;]),
   description: json[&quot;DESCRIPTION&quot;] == null ? null : Affecteddate.fromJson(json[&quot;DESCRIPTION&quot;]),
   assetsiteid: json[&quot;ASSETSITEID&quot;] == null ? null : Affecteddate.fromJson(json[&quot;ASSETSITEID&quot;]),
   assetnum: json[&quot;ASSETNUM&quot;] == null ? null : Affecteddate.fromJson(json[&quot;ASSETNUM&quot;]),
   location: json[&quot;LOCATION&quot;] == null ? null : Affecteddate.fromJson(json[&quot;LOCATION&quot;]),
     descriptionLongdescription: json[&quot;DESCRIPTION_LONGDESCRIPTION&quot;] == null ? null : Affecteddate.fromJson(json[&quot;DESCRIPTION_LONGDESCRIPTION&quot;]),
        );
  
    Map&lt;String, dynamic&gt; toJson() =&gt; {
          &quot;TICKETID&quot;: ticketid.toJson(),
          &quot;CLASS&quot;: attributesClass.toJson(),
          &quot;STATUS&quot;: status.toJson(),
          &quot;STATUSDATE&quot;: statusdate.toJson(),
          &quot;REPORTEDBY&quot;: reportedby.toJson(),
          &quot;DESCRIPTION&quot;: description == null ? null : description.toJson(),
          &quot;ASSETSITEID&quot;: assetsiteid == null ? null : assetsiteid.toJson(),
          &quot;ASSETNUM&quot;: assetnum == null ? null : assetnum.toJson(),
          &quot;LOCATION&quot;: location == null ? null : location.toJson(),
        };
  }
  
  class Affecteddate {
    Affecteddate({
      required this.content,
    });
  
    String content;
  
    factory Affecteddate.fromJson(Map&lt;String, dynamic&gt; json) =&gt; Affecteddate(
          content: json[&quot;content&quot;],
        );
  
    Map&lt;String, dynamic&gt; toJson() =&gt; {
          &quot;content&quot;: content,
        };
  }
  </code></pre>
  <p>and  this is the code for importing the data its working fine before i add the descriptions</p>
  <pre><code>import 'dart:convert';
  import 'dart:io';
  import 'package:flutter/material.dart';
  import 'package:http/http.dart' as http;
  import 'package:myapp2/Service_Request/SR.dart';
  import 'package:myapp2/main.dart';
  import 'package:myapp2/Service_Request/second.dart';
  import '../Classes/demandes.dart';
  import 'SR_details.dart';
  
  class MyApp extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return MaterialApp(
        home: DataFromAPI(),
      );
    }
  }
  
  class DataFromAPI extends StatefulWidget {
    @override
    _DataFromAPIState createState() =&gt; _DataFromAPIState();
  }
  
  List&lt;Attributes&gt; MyAllData = [];
  
  class _DataFromAPIState extends State&lt;DataFromAPI&gt; {
    @override
    void initState() {
      super.initState();
    }
  
    Future&lt;List&lt;Sr&gt;&gt; loadData() async {
      try {
        var response = await http.get(Uri.parse(
            'http://192.168.1.30:9080/maxrest/rest/mbo/sr/?_lid=azizl&amp;_lpwd=max12345m&amp;_format=json'));
        if (response.statusCode == 200) {
          final jsonBody = json.decode(response.body);
          Demandes data = Demandes.fromJson(jsonBody);
          final srAttributes = data.srMboSet.sr;
          return srAttributes;
        }
      } catch (e) {
        throw Exception(e.toString());
      }
      throw Exception(&quot;&quot;);
    }
  
    @override
    Widget build(BuildContext context) {
      return MaterialApp(
        home: new Scaffold(
          appBar: AppBar(
            title: Text('Liste des Demandes'),
            leading: IconButton(
                icon: Icon(Icons.arrow_back),
                onPressed: () =&gt; Navigator.push(
                    context, MaterialPageRoute(builder: (context) =&gt; SR()))),
          ),
          body: FutureBuilder&lt;List&lt;Sr&gt;?&gt;(
            future: loadData(),
            builder: (context, snapshot) {
              if (!snapshot.hasData) {
                return CircularProgressIndicator();
              } else {
                return new ListView.builder(
                    itemCount: snapshot.data?.length,
                    itemBuilder: ((_, index) {
                      return new ListTile(
                          title: new Card(
                            child: new ListTile(
                              title: new Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: &lt;Widget&gt;[
                                  new Text(
                                      'Ticket ID  : ${snapshot.data![index].attributes.ticketid.content}'),
                                  new Text(
                                      'status  : ${snapshot.data![index].attributes.status.content}'),
                                  new Text(
                                      'reportedby  : ${snapshot.data![index].attributes.reportedby.content}'),
                                  new Text(
                                      'Status Date  : ${snapshot.data![index].attributes.statusdate.content}'),
                                        new Text(
                                      'Status Date  : ${snapshot.data![index].attributes.description.content}'),
                                ],
                              ),
                            ),
                          ),
                          onTap: () {
                            Navigator.of(context).push(
                              new MaterialPageRoute(
                                builder: (BuildContext context) =&gt;
                                    new SrDetailsScreen(
                                        sr: snapshot.data![index]),
                              ),
                            );
                          });
                    }));
              }
            },
          ),
        ),
      );
    }
  }
  </code></pre>