简体   繁体   中英

inheritance of named arguments of constructor in Dart

I have a dart class with a lot of named 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?

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. 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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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