title: How to create JSON object in flutter?
body: <p>I'm working on one application in which I want to fill the registration form and pass this data to API.I tried almost all solutions but not solved this issue.</p>
  <p>I'm getting this type of data after filling the form</p>
  <pre><code>[
  {Date of Birth of the Baby: 08/01/1997},
  {Gender of the baby: male}, 
  {Time of Birth of the Baby: 12.00 pm}, 
  {Father's Name: Nnn}, 
  {Mother's Name: Hbhh}, 
  {Any Extra Details?: Bnn}
  ]
  </code></pre>
  <p>and I want this type of data</p>
  <pre><code> {
      &quot;Date of Birth of the Baby&quot;: &quot;08/01/1997&quot;,
      &quot;Gender of the baby&quot;: &quot;male&quot;,
      &quot;Time of Birth of the Baby&quot;: &quot;12.00 pm&quot;,
      &quot;Father's Name&quot;: &quot;Nnn&quot;,
      &quot;Mother's Name&quot;: &quot;Hbhh&quot;,
      &quot;Any Extra Details?&quot;: &quot;Bnn&quot;
  }
  </code></pre>
  <p>var fieldsData = [];
  final myControllers = [];</p>
  <pre><code> mydynamicData() {
  
      for (var i = 0; i &lt;= widget.fieldData.length; i++) {
        fieldsData.add({
          widget.fieldData[i]['question'],
          myControllers[i].text != null || myControllers[i].text != &quot;&quot;
              ? myControllers[i].text
              : &quot;&quot;
        });
  
      }
  
      print(&quot;fieldsData:${fieldsData}&quot;);
  
    }
  </code></pre>
  <p>This is my method i know this issue occurred due to for loop but without for loop I'm not getting all fields data. so please help.</p>