What is the format of the “arguments” parameter to ClassMirror.newInstance()?

前端 未结 1 719
迷失自我
迷失自我 2021-01-26 02:36

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/Clas

相关标签:
1条回答
  • 2021-01-26 03:28

    This should work

    cls.newInstance(new Symbol(''), ['a', 1] /*, 
        {#arg1Name: 'arg1Value', #arg2Name: 'arg2Value'}*/ );
    

    and is like

    new MyClass('a', 1, arg1Name: 'arg1Value' /*, arg2Name: 'arg2Value'*/); 
    

    Just saw, Named arguments are not implemented.

    You can try it in DartPad

    0 讨论(0)
提交回复
热议问题