title: ExpansionTile in flutter
body: <p>I am trying to build an expansion tile from the data I get from backend and the data from backend looks like </p>
  
  <pre><code>var sampleresponse = [ 
     {"Total Income": 500.0},
     {"Total Expense": 1000.0},
     {"Maintenance": 500.0},
     {"Tank Water": 100.0, "truck Charges": 900.0},
  ];
  
  var sampletotalIncome = sampleresponse[0];
  var sampletotalExpense = sampleresponse[1];
  var sampledetailIncome = sampleresponse[2];
  var sampledetailExpense = sampleresponse[3];
  
  var sampletotalIncomeKeys = sampletotalIncome.keys;
  var sampletotalExpenseKeys = sampletotalExpense.keys;
  var sampledetailIncomeKeys = sampledetailIncome.Keys;
  var sampledetailExpenseKeys = sampledetailExpense.keys;
  
  var sampletotalIncomevalue = sampletotalIncome.value;
  var sampletotalExpensevalue = sampletotalExpense.value;
  var sampledetailIncomevalue = sampledetailIncome.value;
  var sampledetailExpensevalue= sampledetailExpense.value;
  
  //sampletotalIncomeKeys is [Total Income] 
  //sampletotalIncomevalue is [500.0] 
  //sampletotalExpenseKeys is [Total Expense] 
  //sampletotalExpensevalue is [1000.0] 
  //sampledetailIncomeKeys is [Maintanence] 
  //sampledetailIncomevalue is [500.0] 
  //sampledetailExpenseKeys is [Tank Water, truck Charges] 
  //sampledetailedExpensevalue is [100.0, 900.0]
  </code></pre>
  
  <p>where "Maintenance":500.0 should be placed under "Total Income" and the "Total Expense" should contain the "Tank Water" and "truck Charges". Here is my code:</p>
  
  <p>Snippet from ExpansionTile.dart:</p>
  
  <pre><code>import 'package:flutter/material.dart';
  
  class StuffInTiles extends StatelessWidget {
  final MyTile myTile;
  
  StuffInTiles(this.myTile);
  
  @override
  Widget build(BuildContext context) {
    return _buildTiles(myTile);
  }
  
  Widget _buildTiles(MyTile t) {
    if (t.children.isEmpty)
      return new ListTile(
        title: new Text(
          t.title,
          style: new TextStyle(color: Colors.white),
        ),
        trailing: new Text(
          t.value,
          style: new TextStyle(color: Colors.white),
        ),
      );
    return new ExpansionTile(
      key: new PageStorageKey&lt;MyTile&gt;(t),
      title: new Text(
        t.title,
        style: new TextStyle(color: Colors.white),
      ),
      trailing: new Text(
        t.value,
        style: new TextStyle(color: Colors.white),
      ),
      children: t.children.map(_buildTiles).toList(),
    );
  }
  </code></pre>
  
  <p>}</p>
  
  <pre><code>class MyTile {
   final String title;
   final String value;
   final List&lt;MyTile&gt; children;
  
   MyTile(this.title, this.value, [this.children = const &lt;MyTile&gt;[]]);
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Snippet from Main.dart:</p>
  
  <pre><code>List&lt;MyTile&gt; itemList = &lt;MyTile&gt;[
  
            new MyTile(
              sampletotalIncomeKeys.toString(),
              sampletotalIncomevalue.toString(),
              sampledetailIncomeKeys
                  .map(
                    (items) =&gt; new 
              MyTile(sampledetailIncomeKeys.toString(),
                        sampledetailIncomevalue.toString()),
                  )
                  .toList(),
            ),
            new MyTile(
              sampletotalExpenseKeys.toString(),
              sampletotalExpensevalue.toString(),
              sampledetailedExpense.map((items, value) =&gt; 
              MyTile(items.toString(), value.toString()).toString(),
                ).toString()
  
            ),
          ];
  
   ...........
  new Expanded(
     child: new ListView.builder(
       itemBuilder: (BuildContext context, int index) {
         return new StuffInTiles(itemList[index]);
       },
     itemCount: itemList.length,
    ),
  </code></pre>
  
  <p>)</p>
  
  <p>With this I am getting an error as </p>
  
  <p>"The argument type "String" cannot be assigned to parameter type List. I am not understanding this. Can some please help me with the logic for this?</p>
  
  <p>Thank you!</p>