title: Flutter: How to create nested objects in Flutter to store on Cloud Firestore
body: <p>I am looking for a way to build a collection of categories and sub categories for a market place in Cloud Firestore, I wan to create an Categories and inside every category Map each category with key value pairs, basically a tree stucture. Something similar to down below</p>
  <p>Category 1 ----- &gt; Array</p>
  <p>0 map</p>
  <p>Field ----&gt; String -----&gt; Value</p>
  <p>Field-----&gt;String------&gt; Value</p>
  <p>1 map</p>
  <p>Field ----&gt; String -----&gt; Value</p>
  <p>Field-----&gt;String------&gt; Value</p>
  <pre><code>var results = [
      'Category 1' = [
        {field: string , field: string, field: int}
        {field: string , field: string, field: int}
        {field: string , field: string, field: int}
        'Category x'= [
          {field: string , field: string, field: int}
          {field: string , field: string, field: int}
        ]
      ]
    ];  
  </code></pre>
  <p>This is not a code, this is just the type of structure I am looking for to create in cloud firestore, I am also attaching an image as how to structure will look on cloud firestore.<br />
  <a href="https://i.stack.imgur.com/QqECK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QqECK.png" alt="enter image description here" /></a></p>