title: Making a variable the key in a Map
body: <p>I have two classes</p>
  
   
  
  <pre class="lang-dart prettyprint-override"><code>  class Phone extends Observable
    {
       @observable String type = '';
       @observable String provider = '';
       @observable String num = '';
  
       Map&lt;String, Map&lt;String, String&gt; map = {};
  
       Phone() {}
       Phone.build({ this.type,
                     this.provider,
                     this.num });
    }
  </code></pre>
  
  <p>I have attempted to use the field values as the key in map like so</p>
  
  <pre class="lang-dart prettyprint-override"><code>   Phone phone = new Phone();
     phone.map[phone.type] = {'type':'cell', 'provider':'Verizon', 'num':'1234567'};
  </code></pre>
  
  <p>but it does not work. How can I make the fields value the key for the map?</p>