简体   繁体   English

Dart 中的构造函数的命名为 arguments 的 inheritance

[英]inheritance of named arguments of constructor in Dart

I have a dart class with a lot of named arguments.我有一个 dart class 有很多名为 arguments。 Is there a simple way to "inherit" all named arguments from parent (or mixin) class (and delegate their initialisation to super() ), without repeating all arguments in child constructor?有没有一种简单的方法可以从父(或混合) class (并将它们的初始化委托给 super() )“继承”所有名为 arguments 的所有名称,而无需在子构造函数中重复所有 arguments ?

Short of stuffing all arguments into a separate object and making all of your classes pass that around, no, there is no simple way to forward arguments.没有将所有 arguments 填充到单独的 object 中并让您的所有课程都通过,不,没有简单的方法可以转发 arguments。 There are a number of issues requesting some ability to do so (such as https://github.com/dart-lang/language/issues/493 and the various issues it links to).有许多问题需要一些能力这样做(例如https://github.com/dart-lang/language/issues/493以及它链接到的各种问题)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM