title: Problem with map in Flutter when connecting to firebase
body: <p>I have the class Record3 which gets the data from my cloud firestore:</p>
  <pre><code>class Record3 {
    final String name;
    final int ref;
    final bool display;
    final DocumentReference reference;
  
    Record3.fromMap(Map&lt;String, dynamic&gt; map, {this.reference})
        : assert(map['name'] != null),
          assert(map['ref'] != null),
          assert(map['display'] != null),
          name = map['name'],
          ref = map['ref'];
          display = map['display'];
  
  
    Record3.fromSnapshot(DocumentSnapshot snapshot)
        : this.fromMap(snapshot.data(), reference: snapshot.reference);
  
    @override
    String toString() =&gt; &quot;Record&lt;$name:$ref:$display&gt;&quot;;
  }
  </code></pre>
  <p>I added the field <code>display</code> to the cloud firestore and now I am trying to add it into the record3 code. However, there is an issue with the line <code>display = map['display'];</code>. <code>display</code> throws the error:</p>
  <pre><code>The name 'display' is already defined.
  Try renaming one of the declarations.
  </code></pre>
  <p>And <code>map</code> throws the error:</p>
  <pre><code>Undefined name 'map'.
  Try correcting the name to one that is defined, or defining the name.
  </code></pre>
  <p>I'm not too sure how to fix these errors as both are defined so I have a feeling its something to do with adding <code>display</code> and not having changed variables in map? I'm not sure though so any help would be appreciated!</p>