title: What is the format of the "arguments" parameter to ClassMirror.newInstance()?
body: <p>I'm perfectly willing to play with this until I get it right, but was hoping someone might give me a hint. The parameter is declared in the docs (gen-dartdocs/dart-mirrors/ClassMirror/newInstance.html) as </p>
  
  <pre><code>InstanceMirror newInstance(Symbol constructorName,
                        List positionalArguments,
                        [Map&lt;Symbol,dynamic&gt; namedArguments]);
  </code></pre>
  
  <p>There is a nice writeup on the format of positionalArguments and namedArguments in the docs. However, it is just a little on the abstract side of my current tolerance level.</p>
  
  <p>A decent discussion also exists at 
  <a href="http://japhr.blogspot.com/2014/06/dart-factory-method-pattern.html" rel="nofollow">http://japhr.blogspot.com/2014/06/dart-factory-method-pattern.html</a>
  But, alas, no examples of actually passing args into the method.</p>
  
  <p>In my case, I would like to simply pass two args, "title" and "description" into an unnamed subclass constructor.</p>
  
  <p>Here's my code so far:</p>
  
  <p>file: item.dart</p>
  
  <pre><code>import 'dart:mirrors';
  
  abstract class Item {
  
      String title;
      String description;
  
      factory Item(String type) {
        MirrorSystem libs = currentMirrorSystem();
        LibraryMirror lib = libs.findLibrary(new Symbol('app.models'));
        Map&lt;Symbol, Mirror&gt; classes = lib.declarations;
        // To do: handle exception if class not found
        ClassMirror cls = classes[new Symbol(type)];
        // TODO:
        //  verify each subclass has no-arg ctor
        //  determ how to pass args to ctor.
        InstanceMirror inst = cls.newInstance(new Symbol(''), []);
        return inst.reflectee;
      }
  
      // conflicts w/ Item factory
  //  Item(this.title, this.description);
  }
  </code></pre>
  
  <p>And here's the class that gets instantiated:</p>
  
  <p>file: model.dart</p>
  
  <pre><code>library app.models;
  
  import 'item.dart' show Item;
  
  /// The barebones model for a codelab. Defines constants used for validation.
  class Codelab implements Item {
     // ...
  }
  </code></pre>
  
  <p>Finally, here is how the Item factory is called. ItemElement is the superclass of its own hierarchy, subclassed by CodelabElement:</p>
  
  <p>file: item_element.dart:</p>
  
  <pre><code>import 'item.dart' show Item;
  
  class ItemElement {
      Item item;
      final String itemType;
  
      ItemElement() {
        item = new Item(itemType);
      }
      // ...
  }
  </code></pre>
  
  <p>And CodelabElement:</p>
  
  <p>file: codelab_element.dart</p>
  
  <pre><code>import 'model.dart' show Codelab;
  import 'item_element.dart' show ItemElement;
  
  class CodelabElement extends ItemElement {
  
      final itemType = "Codelab";
  
      CodelabElement() : super() {}
  
      //...
  }
  </code></pre>
  
  <p>And then:</p>
  
  <p>file: main.dart</p>
  
  <pre><code>void main() {
      var element = new CodelabElement();
  }
  </code></pre>
  
  <p>Currently, the new Codelab instance is returned from newInstance() (very cool), but it doesn't contain the inherited 'title' and 'description' attrs.</p>
  
  <p>Maybe it has something to do with my being unclear on the usage of "extends" and "implements".</p>