title: Dart - NoSuchMethodError: Class 'Module' has no instance getter 'String'
body: <p>Could some please explain what is wrong?</p>
  
  <p>I try to get an item by key from HashMap:</p>
  
  <p>If I do it that way:</p>
  
  <p><code>var stringProvider = providersHolder[String]</code>
   I get an error:</p>
  
  <p><strong>NoSuchMethodError: Class 'Module' has no instance getter 'String'.</strong></p>
  
  <p>If I do it next way:</p>
  
  <p><code>var stringProvider = providersHolder[providersHolder.keys.last]</code> 
  where <code>providersHolder.keys.last == String</code></p>
  
  <p><strong>I get success.</strong></p>
  
  <p>Here is a full listing:</p>
  
  <pre><code>class Module {
    HashMap providersHolder = new HashMap&lt;Type, ItemCreator&gt;();
  
    void addProvider&lt;T, M extends Module&gt;(ItemCreator&lt;T, M&gt; itemCreator) {
       providersHolder[T] = itemCreator;
    }
  }
  
  class Test {
      Test() {
        var module = Module();
        module.addProvider((module) =&gt; new Ticker());
        module.addProvider((module) =&gt; "hello");
        var ticketProvider = module.providersHolder[Ticker]; //success
        var stringProvider = module.providersHolder[String]; //error
      } 
  }
  </code></pre>
  
  <p>Here is a watcher: </p>
  
  <p><a href="https://i.stack.imgur.com/Z5daH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Z5daH.png" alt="watcher"></a></p>