title: Object Mapping in Flutter to Realtime DB Firebase
body: <p>I want to save my List with Objects in Firebase Realtime DB. The Problem is, that when I save my objects there, they dont have an auto generated key, their key is 0, 1, 2,... :
  <a href="https://i.stack.imgur.com/JkBNu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JkBNu.png" alt="enter image description here" /></a></p>
  <p>I am mapping my Poll object this way:</p>
  <pre><code>Map&lt;String, dynamic&gt; toJson() =&gt; {
          'id': id,
          'name': name,
          'allowBarChart': allowBarChart,
          'allowPieChart': allowPieChart,
          'description': description,
          'custom-questions': customQuestions != null
              ? List&lt;dynamic&gt;.from(customQuestions.map((x) =&gt; x.toJson()))
              : [],
          'choice-questions': choiceQuestions != null
              ? List&lt;dynamic&gt;.from(choiceQuestions.map((x) =&gt; x.toJson()))
              : [],
        };
  </code></pre>
  <p>My Question is: how to do it, so the key of each value is not 0,1,2,3,... It should be auto generated from firebase, for example: 1fdDfasLPO3g. I hope you know what I mean.
  Thanks in advance!</p>