title: Why DataTable Not Showing JSON in Flutter
body: <p>I was building a <strong>DataTable</strong> from <strong>json</strong> call. Everything is going well but data is not showing.</p>
  
  <pre><code>//standing.dart
  import '../modal/catelog_point_table_model.dart';
  import '../services/category_point_table_services.dart';
  import 'package:flutter/material.dart';
  
  class DataTableWidget extends StatefulWidget {
    @override
    DataTableWidgetState createState() =&gt; DataTableWidgetState();
  }
  
  class DataTableWidgetState extends State&lt;DataTableWidget&gt; {
    final List&lt;String&gt; cityColumns = [
      'Team',
      'M',
      'W',
      'NRR',
      'Pts'
    ];
    List&lt;City&gt; cities;
    bool ascending;
  
    @override
    void initState() {
      super.initState();
      ascending = false;
    }
  
    @override
    Widget build(BuildContext context) {
      final width = MediaQuery.of(context).size.width;
      return SingleChildScrollView(
        scrollDirection: Axis.horizontal,
        child: SizedBox(
          width: width*1.5,
          child: ListView(
            children: &lt;Widget&gt;[
              buildDataTable(),
            ],
          ),
        ),
      );
    }
  
    Widget buildDataTable() =&gt; DataTable(
      sortAscending: ascending,
      columns: cityColumns
          .map(
            (String column) =&gt; DataColumn(
          label: Text(column),
          onSort: (int columnIndex, bool ascending) =&gt; onSortColumn(
              columnIndex: columnIndex, ascending: ascending),
        ),
      )
          .toList(),
      rows: cities.map((City city) =&gt; DataRow(
          cells: [
            DataCell(Text('${city.title}')),
            DataCell(Text('${city.price}')),
            DataCell(Text('${city.description}')),
            DataCell(Text('${city.nrr}')),
            DataCell(Text('${city.pts}')),
          ],
      ))
          .toList(),
    );
  
    void onSortColumn({int columnIndex, bool ascending}) {
      if (columnIndex == 0) {
        setState(() {
          if (ascending) {
            cities.sort((a, b) =&gt; a.title.compareTo(b.title));
          } else {
            cities.sort((a, b) =&gt; b.title.compareTo(a.title));
          }
          this.ascending = ascending;
        });
      }
    }
  }
  
  
  //catelog_point_table_model.dart
  
  import 'dart:async' show Future;
  import '../modal/catelog_point_table_model.dart';
  import 'package:http/http.dart' as http;
  import 'dart:async';
  
  Future&lt;List&lt;City&gt;&gt; loadCatelog(String id) async {
    String url = 'https://icc-point-table.nittodigital.now.sh/api/Catelogs/category/5ce1a425eda9891fa8b51430';
    final response = await http.get(url);
    print(response.body);
    return cities(response.body);
  }
  
  //catelog_point_table_model.dart
  import 'dart:convert';
  
  class City {
    final int imgcount;
    final String id;
    final String title;
    final String price;
    final String description;
    final String nrr;
    final String pts;
    final List&lt;String&gt; gallery;
  
    City({
      this.imgcount,
      this.id,
      this.title,
      this.price,
      this.description,
      this.nrr,
      this.pts,
      this.gallery
    });
  
    factory City.fromJson(Map&lt;String, dynamic&gt; parsedJson) {
      var streetsFromJson  = parsedJson['gallery'];
      //print(streetsFromJson.runtimeType);
      // List&lt;String&gt; streetsList = new List&lt;String&gt;.from(streetsFromJson);
      List&lt;String&gt; galleryList = streetsFromJson.cast&lt;String&gt;();
  
      return new City(
        imgcount: parsedJson['img_v'],
        id: parsedJson['_id'],
        title: parsedJson['title'],
        price: parsedJson['price'],
        description: parsedJson['description'],
        nrr: parsedJson['nrr'],
        pts: parsedJson['pts'],
        gallery: galleryList,
      );
    }
  
  }
  List&lt;City&gt; cities(str) {
      final jsonData = json.decode(str);
      return List&lt;City&gt;.from(jsonData.map((x) =&gt; City.fromJson(x)));
  }
  </code></pre>
  
  <p><strong>NoSuchMethodError: The method 'map' was called on null</strong></p>
  
  <p>This is what I am getting. Maybe I am not getting data because List is not static type.
  it would be really nice if someone told me how to fetch the data correctly and make a bond with DataRow.
  *sorry for my poor English. </p>